Loading fs/bcachefs/alloc_background.h +5 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,11 @@ static inline unsigned bch2_bucket_sectors_fragmented(struct bch_dev *ca, return d ? max(0, ca->mi.bucket_size - d) : 0; } static inline unsigned bch2_bucket_sectors_unstriped(struct bch_alloc_v4 a) { return a.data_type == BCH_DATA_stripe ? a.dirty_sectors : 0; } static inline enum bch_data_type alloc_data_type(struct bch_alloc_v4 a, enum bch_data_type data_type) { Loading fs/bcachefs/bcachefs_format.h +2 −1 Original line number Diff line number Diff line Loading @@ -612,7 +612,8 @@ LE64_BITMASK(BCH_KDF_SCRYPT_P, struct bch_sb_field_crypt, kdf_flags, 32, 48); x(parity, 6) \ x(stripe, 7) \ x(need_gc_gens, 8) \ x(need_discard, 9) x(need_discard, 9) \ x(unstriped, 10) enum bch_data_type { #define x(t, n) BCH_DATA_##t, Loading fs/bcachefs/buckets.c +11 −3 Original line number Diff line number Diff line Loading @@ -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(); } Loading fs/bcachefs/chardev.c +1 −1 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ static long bch2_ioctl_dev_usage(struct bch_fs *c, arg.bucket_size = ca->mi.bucket_size; arg.nr_buckets = ca->mi.nbuckets - ca->mi.first_bucket; for (i = 0; i < BCH_DATA_NR; i++) { for (i = 0; i < ARRAY_SIZE(arg.d); i++) { arg.d[i].buckets = src.d[i].buckets; arg.d[i].sectors = src.d[i].sectors; arg.d[i].fragmented = src.d[i].fragmented; Loading Loading
fs/bcachefs/alloc_background.h +5 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,11 @@ static inline unsigned bch2_bucket_sectors_fragmented(struct bch_dev *ca, return d ? max(0, ca->mi.bucket_size - d) : 0; } static inline unsigned bch2_bucket_sectors_unstriped(struct bch_alloc_v4 a) { return a.data_type == BCH_DATA_stripe ? a.dirty_sectors : 0; } static inline enum bch_data_type alloc_data_type(struct bch_alloc_v4 a, enum bch_data_type data_type) { Loading
fs/bcachefs/bcachefs_format.h +2 −1 Original line number Diff line number Diff line Loading @@ -612,7 +612,8 @@ LE64_BITMASK(BCH_KDF_SCRYPT_P, struct bch_sb_field_crypt, kdf_flags, 32, 48); x(parity, 6) \ x(stripe, 7) \ x(need_gc_gens, 8) \ x(need_discard, 9) x(need_discard, 9) \ x(unstriped, 10) enum bch_data_type { #define x(t, n) BCH_DATA_##t, Loading
fs/bcachefs/buckets.c +11 −3 Original line number Diff line number Diff line Loading @@ -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(); } Loading
fs/bcachefs/chardev.c +1 −1 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ static long bch2_ioctl_dev_usage(struct bch_fs *c, arg.bucket_size = ca->mi.bucket_size; arg.nr_buckets = ca->mi.nbuckets - ca->mi.first_bucket; for (i = 0; i < BCH_DATA_NR; i++) { for (i = 0; i < ARRAY_SIZE(arg.d); i++) { arg.d[i].buckets = src.d[i].buckets; arg.d[i].sectors = src.d[i].sectors; arg.d[i].fragmented = src.d[i].fragmented; Loading