On 2017/06/26 17:23, Gu Jinxiang wrote: > For code maintainability and scalability, > replace number with a macro of member blocks in btrfs_mkfs_config. > > Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> > --- > mkfs/common.c | 2 +- > mkfs/common.h | 5 ++++- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/mkfs/common.c b/mkfs/common.c > index e4785c5..420671b 100644 > --- a/mkfs/common.c > +++ b/mkfs/common.c > @@ -94,7 +94,7 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg) > uuid_generate(chunk_tree_uuid); > > cfg->blocks[0] = BTRFS_SUPER_INFO_OFFSET; > - for (i = 1; i < 7; i++) { > + for (i = 1; i <= BTRFS_MKFS_ROOTS_NR; i++) {
If you change 7 to BTRFS_MKFS_ROOTS_NR, you also need to change the following code. 213 for (i = 1; i < 7; i++) { Thanks, Tsutomu > cfg->blocks[i] = BTRFS_SUPER_INFO_OFFSET + 1024 * 1024 + > cfg->nodesize * i; > } > diff --git a/mkfs/common.h b/mkfs/common.h > index 666a75b..e23e79b 100644 > --- a/mkfs/common.h > +++ b/mkfs/common.h > @@ -28,6 +28,9 @@ > #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M > #define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G > > +/* roots: root tree, extent tree, chunk tree, dev tree, fs tree, csum tree */ > +#define BTRFS_MKFS_ROOTS_NR 6 > + > struct btrfs_mkfs_config { > /* Label of the new filesystem */ > const char *label; > @@ -43,7 +46,7 @@ struct btrfs_mkfs_config { > /* Output fields, set during creation */ > > /* Logical addresses of superblock [0] and other tree roots */ > - u64 blocks[8]; > + u64 blocks[BTRFS_MKFS_ROOTS_NR + 1]; > char fs_uuid[BTRFS_UUID_UNPARSED_SIZE]; > char chunk_uuid[BTRFS_UUID_UNPARSED_SIZE]; > > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html