diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-10-21 14:58:32 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-01-03 15:09:42 +0100 |
commit | c91666b1f61915f2b2f2358f922c9d7d44480d0a (patch) | |
tree | f99cf42dc6cc5585497d8480a75ca8545b3e0fb8 /fs/btrfs/ctree.h | |
parent | 227f3cd0d5a157c30480e2cd95f4271be1ace7bc (diff) | |
download | linux-c91666b1f61915f2b2f2358f922c9d7d44480d0a.tar.bz2 |
btrfs: add btrfs_set_item_*_nr() helpers
We have the pattern of
item = btrfs_item_nr(slot);
btrfs_set_item_*(leaf, item);
in a bunch of places in our code. Fix this by adding
btrfs_set_item_*_nr() helpers which will do the appropriate work, and
replace those calls with
btrfs_set_item_*_nr(leaf, slot);
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 5fe5eccb3c87..cb0871f4cd35 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1997,6 +1997,18 @@ static inline u32 btrfs_item_size_nr(const struct extent_buffer *eb, int nr) return btrfs_item_size(eb, btrfs_item_nr(nr)); } +static inline void btrfs_set_item_size_nr(struct extent_buffer *eb, int nr, + u32 val) +{ + btrfs_set_item_size(eb, btrfs_item_nr(nr), val); +} + +static inline void btrfs_set_item_offset_nr(struct extent_buffer *eb, int nr, + u32 val) +{ + btrfs_set_item_offset(eb, btrfs_item_nr(nr), val); +} + static inline void btrfs_item_key(const struct extent_buffer *eb, struct btrfs_disk_key *disk_key, int nr) { |