diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-08-22 16:07:37 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:25 -0400 |
commit | 3fb5ebcdd4b0599ba8d20a322d322f3a1aaea381 (patch) | |
tree | 97b68eec2b9dce3c9b6ea6445513a699684ef4a4 /fs/bcachefs/extents.h | |
parent | 416f6852523d8599713b756b2d2027d2e9f90b3f (diff) | |
download | lwn-3fb5ebcdd4b0599ba8d20a322d322f3a1aaea381.tar.gz lwn-3fb5ebcdd4b0599ba8d20a322d322f3a1aaea381.zip |
bcachefs: Inline some fast paths
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extents.h')
-rw-r--r-- | fs/bcachefs/extents.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h index cef93af25858..4c4a7945a751 100644 --- a/fs/bcachefs/extents.h +++ b/fs/bcachefs/extents.h @@ -540,7 +540,18 @@ static inline void bch2_cut_front(struct bpos where, struct bkey_i *k) } bool bch2_cut_back(struct bpos, struct bkey *); -void bch2_key_resize(struct bkey *, unsigned); + +/** + * bch_key_resize - adjust size of @k + * + * bkey_start_offset(k) will be preserved, modifies where the extent ends + */ +static inline void bch2_key_resize(struct bkey *k, unsigned new_size) +{ + k->p.offset -= k->size; + k->p.offset += new_size; + k->size = new_size; +} /* * In extent_sort_fix_overlapping(), insert_fixup_extent(), |