btrfs-progs: convert: use cfg->leaf_data_size

The mkfs_config can hold the BTRFS_LEAF_DATA_SIZE, so calculate this at
config creation time and then use that value throughout convert instead
of calling __BTRFS_LEAF_DATA_SIZE.

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:14 -05:00 committed by David Sterba
parent 6cf2da1f6f
commit bcaf307195
2 changed files with 5 additions and 4 deletions

View file

@ -238,7 +238,7 @@ static int setup_temp_root_tree(int fd, struct btrfs_mkfs_config *cfg,
u64 dev_bytenr, u64 fs_bytenr, u64 csum_bytenr)
{
struct extent_buffer *buf = NULL;
u32 itemoff = __BTRFS_LEAF_DATA_SIZE(cfg->nodesize);
u32 itemoff = cfg->leaf_data_size;
int slot = 0;
int ret;
@ -419,7 +419,7 @@ static int setup_temp_chunk_tree(int fd, struct btrfs_mkfs_config *cfg,
u64 chunk_bytenr)
{
struct extent_buffer *buf = NULL;
u32 itemoff = __BTRFS_LEAF_DATA_SIZE(cfg->nodesize);
u32 itemoff = cfg->leaf_data_size;
int slot = 0;
int ret;
@ -490,7 +490,7 @@ static int setup_temp_dev_tree(int fd, struct btrfs_mkfs_config *cfg,
u64 dev_bytenr)
{
struct extent_buffer *buf = NULL;
u32 itemoff = __BTRFS_LEAF_DATA_SIZE(cfg->nodesize);
u32 itemoff = cfg->leaf_data_size;
int slot = 0;
int ret;
@ -688,7 +688,7 @@ static int setup_temp_extent_tree(int fd, struct btrfs_mkfs_config *cfg,
u64 fs_bytenr, u64 csum_bytenr)
{
struct extent_buffer *buf = NULL;
u32 itemoff = __BTRFS_LEAF_DATA_SIZE(cfg->nodesize);
u32 itemoff = cfg->leaf_data_size;
int slot = 0;
int ret;

View file

@ -1228,6 +1228,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
mkfs_cfg.sectorsize = blocksize;
mkfs_cfg.stripesize = blocksize;
mkfs_cfg.features = features;
mkfs_cfg.leaf_data_size = __BTRFS_LEAF_DATA_SIZE(nodesize);
printf("Create initial btrfs filesystem\n");
ret = make_convert_btrfs(fd, &mkfs_cfg, &cctx);