diff options
Diffstat (limited to 'mkfs')
-rw-r--r-- | mkfs/common.c | 6 | ||||
-rw-r--r-- | mkfs/common.h | 5 | ||||
-rw-r--r-- | mkfs/main.c | 8 |
3 files changed, 9 insertions, 10 deletions
diff --git a/mkfs/common.c b/mkfs/common.c index 8d92eae2..1e6a3241 100644 --- a/mkfs/common.c +++ b/mkfs/common.c @@ -92,6 +92,12 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg) uuid_generate(super.dev_item.uuid); uuid_generate(chunk_tree_uuid); + cfg->blocks[0] = BTRFS_SUPER_INFO_OFFSET; + for (i = 1; i < 7; i++) { + cfg->blocks[i] = BTRFS_SUPER_INFO_OFFSET + 1024 * 1024 + + cfg->nodesize * i; + } + btrfs_set_super_bytenr(&super, cfg->blocks[0]); btrfs_set_super_num_devices(&super, 1); btrfs_set_super_magic(&super, BTRFS_MAGIC_PARTIAL); diff --git a/mkfs/common.h b/mkfs/common.h index 09edc28b..00f219a8 100644 --- a/mkfs/common.h +++ b/mkfs/common.h @@ -39,10 +39,11 @@ struct btrfs_mkfs_config { u64 features; /* Size of the filesystem in bytes */ u64 num_bytes; - /* Logical addresses of superblock [0] and other tree roots */ - u64 blocks[8]; /* Output fields, set during creation */ + + /* Logical addresses of superblock [0] and other tree roots */ + u64 blocks[8]; char fs_uuid[BTRFS_UUID_UNPARSED_SIZE]; char chunk_uuid[BTRFS_UUID_UNPARSED_SIZE]; diff --git a/mkfs/main.c b/mkfs/main.c index 0823b4fb..be84263a 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1400,7 +1400,6 @@ int main(int argc, char **argv) char *label = NULL; u64 block_count = 0; u64 dev_block_count = 0; - u64 blocks[7]; u64 alloc_start = 0; u64 metadata_profile = 0; u64 data_profile = 0; @@ -1723,12 +1722,6 @@ int main(int argc, char **argv) exit(1); } - blocks[0] = BTRFS_SUPER_INFO_OFFSET; - for (i = 1; i < 7; i++) { - blocks[i] = BTRFS_SUPER_INFO_OFFSET + 1024 * 1024 + - nodesize * i; - } - if (group_profile_max_safe_loss(metadata_profile) < group_profile_max_safe_loss(data_profile)){ warning("metadata has lower redundancy than data!\n"); @@ -1736,7 +1729,6 @@ int main(int argc, char **argv) mkfs_cfg.label = label; memcpy(mkfs_cfg.fs_uuid, fs_uuid, sizeof(mkfs_cfg.fs_uuid)); - memcpy(mkfs_cfg.blocks, blocks, sizeof(blocks)); mkfs_cfg.num_bytes = dev_block_count; mkfs_cfg.nodesize = nodesize; mkfs_cfg.sectorsize = sectorsize; |