aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorGravatar Josef Bacik <josef@toxicpanda.com> 2021-10-21 14:58:34 -0400
committerGravatar David Sterba <dsterba@suse.com> 2022-01-03 15:09:43 +0100
commit747942073608167af3cdbaace2556b13c0cff9f0 (patch)
treeb15ae897fbd05cbcb229e9d6b1b701c68ed94522 /fs/btrfs/ctree.h
parentbtrfs: make btrfs_file_extent_inline_item_len take a slot (diff)
downloadlinux-747942073608167af3cdbaace2556b13c0cff9f0.tar.gz
linux-747942073608167af3cdbaace2556b13c0cff9f0.tar.bz2
linux-747942073608167af3cdbaace2556b13c0cff9f0.zip
btrfs: introduce item_nr token variant helpers
The last remaining place where we have the pattern of item = btrfs_item_nr(slot) <do something with the item> are the token helpers. Handle this by introducing token helpers that will do the btrfs_item_nr() work inside of the helper itself, and then convert all users of the btrfs_item token helpers to the new _nr() variants. 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.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index e0cb78fa5810..53fc20482c8d 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2009,6 +2009,38 @@ static inline void btrfs_set_item_offset_nr(struct extent_buffer *eb, int nr,
btrfs_set_item_offset(eb, btrfs_item_nr(nr), val);
}
+static inline u32 btrfs_token_item_offset_nr(struct btrfs_map_token *token,
+ int slot)
+{
+ struct btrfs_item *item = btrfs_item_nr(slot);
+
+ return btrfs_token_item_offset(token, item);
+}
+
+static inline u32 btrfs_token_item_size_nr(struct btrfs_map_token *token,
+ int slot)
+{
+ struct btrfs_item *item = btrfs_item_nr(slot);
+
+ return btrfs_token_item_size(token, item);
+}
+
+static inline void btrfs_set_token_item_offset_nr(struct btrfs_map_token *token,
+ int slot, u32 val)
+{
+ struct btrfs_item *item = btrfs_item_nr(slot);
+
+ btrfs_set_token_item_offset(token, item, val);
+}
+
+static inline void btrfs_set_token_item_size_nr(struct btrfs_map_token *token,
+ int slot, u32 val)
+{
+ struct btrfs_item *item = btrfs_item_nr(slot);
+
+ btrfs_set_token_item_size(token, item, val);
+}
+
static inline void btrfs_item_key(const struct extent_buffer *eb,
struct btrfs_disk_key *disk_key, int nr)
{