summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/buckets.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-23 22:34:03 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2024-07-15 01:00:12 +0200
commit2612e29142ff718e6f120c62e6792f0a67fd3005 (patch)
tree4478842165cbf2aaf7a5c9b9dae7335f2431e741 /fs/bcachefs/buckets.c
parentbcachefs: bch_alloc->stripe_sectors (diff)
downloadlinux-2612e29142ff718e6f120c62e6792f0a67fd3005.tar.xz
linux-2612e29142ff718e6f120c62e6792f0a67fd3005.zip
bcachefs: BCH_DATA_unstriped
Add a new pseudo data type, to track buckets that are members of a stripe, but have unstriped data in them. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r--fs/bcachefs/buckets.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 8017faf56b0f..33b75f92b6ae 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -309,12 +309,20 @@ void bch2_dev_usage_update(struct bch_fs *c, struct bch_dev *ca,
u->d[old->data_type].sectors -= bch2_bucket_sectors_dirty(*old);
u->d[new->data_type].sectors += bch2_bucket_sectors_dirty(*new);
- u->d[BCH_DATA_cached].sectors += new->cached_sectors;
- u->d[BCH_DATA_cached].sectors -= old->cached_sectors;
-
u->d[old->data_type].fragmented -= bch2_bucket_sectors_fragmented(ca, *old);
u->d[new->data_type].fragmented += bch2_bucket_sectors_fragmented(ca, *new);
+ u->d[BCH_DATA_cached].sectors -= old->cached_sectors;
+ u->d[BCH_DATA_cached].sectors += new->cached_sectors;
+
+ unsigned old_unstriped = bch2_bucket_sectors_unstriped(*old);
+ u->d[BCH_DATA_unstriped].buckets -= old_unstriped != 0;
+ u->d[BCH_DATA_unstriped].sectors -= old_unstriped;
+
+ unsigned new_unstriped = bch2_bucket_sectors_unstriped(*new);
+ u->d[BCH_DATA_unstriped].buckets += new_unstriped != 0;
+ u->d[BCH_DATA_unstriped].sectors += new_unstriped;
+
preempt_enable();
}