btrfs: remove BTRFS_LEAF_DATA_OFFSET

This is simply the same thing as btrfs_item_nr_offset(leaf, 0), so
remove this helper and replace it's usage with the above statement.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2022-11-15 11:16:18 -05:00 committed by David Sterba
parent 637e3b48c2
commit 8009adf306
3 changed files with 7 additions and 9 deletions

View File

@ -9,8 +9,6 @@ struct btrfs_map_token {
unsigned long offset;
};
#define BTRFS_LEAF_DATA_OFFSET offsetof(struct btrfs_leaf, items)
void btrfs_init_map_token(struct btrfs_map_token *token, struct extent_buffer *eb);
/*
@ -1028,9 +1026,9 @@ BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_size,
/* Cast into the data area of the leaf. */
#define btrfs_item_ptr(leaf, slot, type) \
((type *)(BTRFS_LEAF_DATA_OFFSET + btrfs_item_offset(leaf, slot)))
((type *)(btrfs_item_nr_offset(leaf, 0) + btrfs_item_offset(leaf, slot)))
#define btrfs_item_ptr_offset(leaf, slot) \
((unsigned long)(BTRFS_LEAF_DATA_OFFSET + btrfs_item_offset(leaf, slot)))
((unsigned long)(btrfs_item_nr_offset(leaf, 0) + btrfs_item_offset(leaf, slot)))
#endif

View File

@ -83,8 +83,8 @@ static inline void memmove_leaf_data(const struct extent_buffer *leaf,
unsigned long src_offset,
unsigned long len)
{
memmove_extent_buffer(leaf, BTRFS_LEAF_DATA_OFFSET + dst_offset,
BTRFS_LEAF_DATA_OFFSET + src_offset, len);
memmove_extent_buffer(leaf, btrfs_item_nr_offset(leaf, 0) + dst_offset,
btrfs_item_nr_offset(leaf, 0) + src_offset, len);
}
/*
@ -106,8 +106,8 @@ static inline void copy_leaf_data(const struct extent_buffer *dst,
unsigned long dst_offset,
unsigned long src_offset, unsigned long len)
{
copy_extent_buffer(dst, src, BTRFS_LEAF_DATA_OFFSET + dst_offset,
BTRFS_LEAF_DATA_OFFSET + src_offset, len);
copy_extent_buffer(dst, src, btrfs_item_nr_offset(dst, 0) + dst_offset,
btrfs_item_nr_offset(src, 0) + src_offset, len);
}
/*

View File

@ -2537,7 +2537,7 @@ static void prepare_eb_write(struct extent_buffer *eb)
* header 0 1 2 .. N ... data_N .. data_2 data_1 data_0
*/
start = btrfs_item_nr_offset(eb, nritems);
end = BTRFS_LEAF_DATA_OFFSET;
end = btrfs_item_nr_offset(eb, 0);
if (nritems == 0)
end += BTRFS_LEAF_DATA_SIZE(eb->fs_info);
else