diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-23 18:22:59 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:46 -0400 |
commit | 98638ffa1d914e780a527c0bd92323f0b7307f09 (patch) | |
tree | fe3de1843d0c63f1f6bb1c5268c486ae82563c3c /fs | |
parent | 0aba9eba76442d6887dc98924bb8c0396a79c984 (diff) | |
download | lwn-98638ffa1d914e780a527c0bd92323f0b7307f09.tar.gz lwn-98638ffa1d914e780a527c0bd92323f0b7307f09.zip |
bcachefs: Better inlining in bch2_subvolume_get_snapshot()
This provides an inlined version of bch2_subvolume_get() and uses it in
bch2_subvolume_get_snapshot(), since this is the version that's used all
over the place and in fast paths (e.g. IO paths).
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/subvolume.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/fs/bcachefs/subvolume.c b/fs/bcachefs/subvolume.c index 1133783477e1..0e3b6ae3835a 100644 --- a/fs/bcachefs/subvolume.c +++ b/fs/bcachefs/subvolume.c @@ -795,10 +795,11 @@ void bch2_subvolume_to_text(struct printbuf *out, struct bch_fs *c, le32_to_cpu(s.v->snapshot)); } -int bch2_subvolume_get(struct btree_trans *trans, unsigned subvol, - bool inconsistent_if_not_found, - int iter_flags, - struct bch_subvolume *s) +static __always_inline int +bch2_subvolume_get_inlined(struct btree_trans *trans, unsigned subvol, + bool inconsistent_if_not_found, + int iter_flags, + struct bch_subvolume *s) { struct btree_iter iter; struct bkey_s_c k; @@ -818,6 +819,14 @@ int bch2_subvolume_get(struct btree_trans *trans, unsigned subvol, return ret; } +int bch2_subvolume_get(struct btree_trans *trans, unsigned subvol, + bool inconsistent_if_not_found, + int iter_flags, + struct bch_subvolume *s) +{ + return bch2_subvolume_get_inlined(trans, subvol, inconsistent_if_not_found, iter_flags, s); +} + int bch2_snapshot_get_subvol(struct btree_trans *trans, u32 snapshot, struct bch_subvolume *subvol) { @@ -833,12 +842,12 @@ int bch2_subvolume_get_snapshot(struct btree_trans *trans, u32 subvol, struct bch_subvolume s; int ret; - ret = bch2_subvolume_get(trans, subvol, true, - BTREE_ITER_CACHED| - BTREE_ITER_WITH_UPDATES, - &s); - - *snapid = le32_to_cpu(s.snapshot); + ret = bch2_subvolume_get_inlined(trans, subvol, true, + BTREE_ITER_CACHED| + BTREE_ITER_WITH_UPDATES, + &s); + if (!ret) + *snapid = le32_to_cpu(s.snapshot); return ret; } |