@@ -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;
@@ -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)
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. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- kernel-shared/ctree.h | 4 ++-- kernel-shared/disk-io.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)