btrfs-progs: Introduce sectorsize nodesize and stripesize members for
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Wed, 17 May 2017 08:57:35 +0000 (16:57 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 3 Jul 2017 11:35:10 +0000 (13:35 +0200)
btrfs_fs_info

Just like what we do in kernel, since we will not support different
leaf/node/stripe size per tree, there is no need to store these block
sizes in btrfs_root.

This patch will introduce these block size members into btrfs_fs_info
structure, allowing us to convert such usage in later patches.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
chunk-recover.c
ctree.h
disk-io.c

index cf8b318..1a88003 100644 (file)
@@ -1475,6 +1475,9 @@ open_ctree_with_broken_chunk(struct recover_control *rc)
        }
 
        memcpy(fs_info->fsid, &disk_super->fsid, BTRFS_FSID_SIZE);
+       fs_info->sectorsize = btrfs_super_sectorsize(disk_super);
+       fs_info->nodesize = btrfs_super_nodesize(disk_super);
+       fs_info->stripesize = btrfs_super_stripesize(disk_super);
 
        ret = btrfs_check_fs_compatibility(disk_super, OPEN_CTREE_WRITES);
        if (ret)
diff --git a/ctree.h b/ctree.h
index c457a8d..78956a4 100644 (file)
--- a/ctree.h
+++ b/ctree.h
@@ -1147,6 +1147,10 @@ struct btrfs_fs_info {
        struct cache_tree *fsck_extent_cache;
        struct cache_tree *corrupt_blocks;
 
+       /* Cached block sizes */
+       u32 nodesize;
+       u32 sectorsize;
+       u32 stripesize;
 };
 
 /*
index 838d5cd..bfdac5a 100644 (file)
--- a/disk-io.c
+++ b/disk-io.c
@@ -1327,6 +1327,9 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
        }
 
        memcpy(fs_info->fsid, &disk_super->fsid, BTRFS_FSID_SIZE);
+       fs_info->sectorsize = btrfs_super_sectorsize(disk_super);
+       fs_info->nodesize = btrfs_super_nodesize(disk_super);
+       fs_info->stripesize = btrfs_super_stripesize(disk_super);
 
        ret = btrfs_check_fs_compatibility(fs_info->super_copy, flags);
        if (ret)