btrfs-progs: store BTRFS_LEAF_DATA_SIZE in the fs_info

This is going to be a different value based on the incompat settings of
the file system, just store this in the fs_info instead of calculating
it every time.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2022-02-22 17:26:13 -05:00 committed by David Sterba
parent 7300aeecff
commit 6cf2da1f6f
2 changed files with 3 additions and 2 deletions

View File

@ -363,8 +363,7 @@ static inline u32 __BTRFS_LEAF_DATA_SIZE(u32 nodesize)
return nodesize - sizeof(struct btrfs_header);
}
#define BTRFS_LEAF_DATA_SIZE(fs_info) \
(__BTRFS_LEAF_DATA_SIZE(fs_info->nodesize))
#define BTRFS_LEAF_DATA_SIZE(fs_info) (fs_info->leaf_data_size)
/*
* this is a very generous portion of the super block, giving us
@ -1271,6 +1270,7 @@ struct btrfs_fs_info {
u32 nodesize;
u32 sectorsize;
u32 stripesize;
u32 leaf_data_size;
u16 csum_type;
u16 csum_size;

View File

@ -1552,6 +1552,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
fs_info->stripesize = btrfs_super_stripesize(disk_super);
fs_info->csum_type = btrfs_super_csum_type(disk_super);
fs_info->csum_size = btrfs_super_csum_size(disk_super);
fs_info->leaf_data_size = __BTRFS_LEAF_DATA_SIZE(fs_info->nodesize);
ret = btrfs_check_fs_compatibility(fs_info->super_copy, flags);
if (ret)