From: Kent Overstreet Date: Sat, 22 Mar 2025 01:16:50 +0000 (-0400) Subject: bcachefs: Kill unnecessary bch2_dev_usage_read() X-Git-Tag: io_uring-6.15-20250403~68^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=d8bdc8daac1d1b0a4efb1ecc69bef4eb4fc5e050;p=linux-block.git bcachefs: Kill unnecessary bch2_dev_usage_read() bch2_dev_usage_read() is fairly expensive, we should optimize this more. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c index 95aafc232290..0cac65347a5d 100644 --- a/fs/bcachefs/alloc_foreground.c +++ b/fs/bcachefs/alloc_foreground.c @@ -631,7 +631,7 @@ static inline void bch2_dev_stripe_increment_inlined(struct bch_dev *ca, struct bch_dev_usage *usage) { u64 *v = stripe->next_alloc + ca->dev_idx; - u64 free_space = dev_buckets_available(ca, BCH_WATERMARK_normal); + u64 free_space = __dev_buckets_available(ca, *usage, BCH_WATERMARK_normal); u64 free_space_inv = free_space ? div64_u64(1ULL << 48, free_space) : 1ULL << 48;