summaryrefslogtreecommitdiff
path: root/libbcachefs/buckets.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-26 22:33:04 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-27 21:04:03 -0500
commit97c86db4f286fef4c7c18b5b96940e64c97e31b4 (patch)
tree6f8f0dfd31a6f0a4f23e23b76552575bf1b0f532 /libbcachefs/buckets.c
parent7465d1934c0c1538b0be0ec348364a95e948a651 (diff)
Update bcachefs sources to feaca6edbd24 mean and variance: Promote to lib/math
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/buckets.c')
-rw-r--r--libbcachefs/buckets.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libbcachefs/buckets.c b/libbcachefs/buckets.c
index 50eb6ba2..312bd0c8 100644
--- a/libbcachefs/buckets.c
+++ b/libbcachefs/buckets.c
@@ -334,7 +334,7 @@ static void bch2_dev_usage_update(struct bch_fs *c, struct bch_dev *ca,
preempt_enable();
}
-struct bch_alloc_v4 bucket_m_to_alloc(struct bucket b)
+static inline struct bch_alloc_v4 bucket_m_to_alloc(struct bucket b)
{
return (struct bch_alloc_v4) {
.gen = b.gen,
@@ -346,13 +346,12 @@ struct bch_alloc_v4 bucket_m_to_alloc(struct bucket b)
}
static void bch2_dev_usage_update_m(struct bch_fs *c, struct bch_dev *ca,
- struct bucket old, struct bucket new,
- u64 journal_seq, bool gc)
+ struct bucket old, struct bucket new)
{
bch2_dev_usage_update(c, ca,
bucket_m_to_alloc(old),
bucket_m_to_alloc(new),
- journal_seq, gc);
+ 0, true);
}
static inline int __update_replicas(struct bch_fs *c,
@@ -658,7 +657,7 @@ int bch2_mark_metadata_bucket(struct bch_fs *c, struct bch_dev *ca,
err:
bucket_unlock(g);
if (!ret)
- bch2_dev_usage_update_m(c, ca, old, new, 0, true);
+ bch2_dev_usage_update_m(c, ca, old, new);
percpu_up_read(&c->mark_lock);
return ret;
}
@@ -773,7 +772,6 @@ static int mark_stripe_bucket(struct btree_trans *trans,
unsigned flags)
{
struct bch_fs *c = trans->c;
- u64 journal_seq = trans->journal_res.seq;
const struct bch_stripe *s = bkey_s_c_to_stripe(k).v;
unsigned nr_data = s->nr_blocks - s->nr_redundant;
bool parity = ptr_idx >= nr_data;
@@ -820,7 +818,7 @@ static int mark_stripe_bucket(struct btree_trans *trans,
err:
bucket_unlock(g);
if (!ret)
- bch2_dev_usage_update_m(c, ca, old, new, journal_seq, true);
+ bch2_dev_usage_update_m(c, ca, old, new);
percpu_up_read(&c->mark_lock);
printbuf_exit(&buf);
return ret;
@@ -843,8 +841,12 @@ static int __mark_pointer(struct btree_trans *trans,
return ret;
*dst_sectors += sectors;
- *bucket_data_type = *dirty_sectors || *cached_sectors
- ? ptr_data_type : 0;
+
+ if (!*dirty_sectors && !*cached_sectors)
+ *bucket_data_type = 0;
+ else if (*bucket_data_type != BCH_DATA_stripe)
+ *bucket_data_type = ptr_data_type;
+
return 0;
}
@@ -855,7 +857,6 @@ static int bch2_mark_pointer(struct btree_trans *trans,
s64 sectors,
unsigned flags)
{
- u64 journal_seq = trans->journal_res.seq;
struct bch_fs *c = trans->c;
struct bch_dev *ca = bch_dev_bkey_exists(c, p.ptr.dev);
struct bucket old, new, *g;
@@ -882,7 +883,7 @@ static int bch2_mark_pointer(struct btree_trans *trans,
new = *g;
bucket_unlock(g);
if (!ret)
- bch2_dev_usage_update_m(c, ca, old, new, journal_seq, true);
+ bch2_dev_usage_update_m(c, ca, old, new);
percpu_up_read(&c->mark_lock);
return ret;