diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-21 14:01:19 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:44 -0400 |
commit | ed80c5699a23c4005ba8e81d4b8fb3e1b922fa40 (patch) | |
tree | 3c2dd5e984480c39efbaa6ea19011bacbeec10d1 /fs/bcachefs/buckets.h | |
parent | 2d485df3da368193dafc78be933669d427b7ddf7 (diff) | |
download | linux-stable-ed80c5699a23c4005ba8e81d4b8fb3e1b922fa40.tar.gz linux-stable-ed80c5699a23c4005ba8e81d4b8fb3e1b922fa40.tar.bz2 linux-stable-ed80c5699a23c4005ba8e81d4b8fb3e1b922fa40.zip |
bcachefs: Optimize bch2_dev_usage_read()
- add bch2_dev_usage_read_fast(), which doesn't return by value -
bch_dev_usage is big enough that we don't want the silent memcpy
- tweak the allocation path to only call bch2_dev_usage_read() once per
bucket allocated
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.h')
-rw-r--r-- | fs/bcachefs/buckets.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h index b4cf10a47c52..a43622193355 100644 --- a/fs/bcachefs/buckets.h +++ b/fs/bcachefs/buckets.h @@ -120,7 +120,15 @@ static inline u8 ptr_stale(struct bch_dev *ca, /* Device usage: */ -struct bch_dev_usage bch2_dev_usage_read(struct bch_dev *); +void bch2_dev_usage_read_fast(struct bch_dev *, struct bch_dev_usage *); +static inline struct bch_dev_usage bch2_dev_usage_read(struct bch_dev *ca) +{ + struct bch_dev_usage ret; + + bch2_dev_usage_read_fast(ca, &ret); + return ret; +} + void bch2_dev_usage_init(struct bch_dev *); static inline u64 bch2_dev_buckets_reserved(struct bch_dev *ca, enum alloc_reserve reserve) |