diff options
author | Daniel Hill <daniel@gluo.nz> | 2022-06-23 01:28:30 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:34 +0300 |
commit | 58aaa0836be3be279f17db9ba07f3a58da033a9f (patch) | |
tree | 4dce3bc7364b0d04a6b8e44ba62eb06a106c90f4 /fs/bcachefs/buckets.h | |
parent | 2817d453819a10654ac72e5f4937d4653dea1648 (diff) | |
download | linux-58aaa0836be3be279f17db9ba07f3a58da033a9f.tar.xz |
bcachefs: fix __dev_available().
__dev_available() now calculates available buckets correctly. Previously
it would almost always return 0 when we have cached data.
Signed-off-by: Daniel Hill <daniel@gluo.nz>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.h')
-rw-r--r-- | fs/bcachefs/buckets.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h index 080bcb20a5b0..b4cf10a47c52 100644 --- a/fs/bcachefs/buckets.h +++ b/fs/bcachefs/buckets.h @@ -159,12 +159,12 @@ static inline u64 __dev_buckets_available(struct bch_dev *ca, enum alloc_reserve reserve) { return max_t(s64, 0, - usage.d[BCH_DATA_free].buckets - - usage.d[BCH_DATA_cached].buckets - - usage.d[BCH_DATA_need_gc_gens].buckets - - usage.d[BCH_DATA_need_discard].buckets - - ca->nr_open_buckets - - bch2_dev_buckets_reserved(ca, reserve)); + usage.d[BCH_DATA_free].buckets + + usage.d[BCH_DATA_cached].buckets + + usage.d[BCH_DATA_need_gc_gens].buckets + + usage.d[BCH_DATA_need_discard].buckets + - ca->nr_open_buckets + - bch2_dev_buckets_reserved(ca, reserve)); } static inline u64 dev_buckets_available(struct bch_dev *ca, |