summaryrefslogtreecommitdiff
path: root/find-root.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2013-03-06 17:32:51 +0100
committerDavid Sterba <dsterba@suse.cz>2013-03-10 16:12:21 +0100
commitdd21bc16ad9bfd87df9311b39dad425ee533eb78 (patch)
tree0d8cd4e374eaeb0dd30f6aa4603d7d6a073280b4 /find-root.c
parentfc61b53da8dba69d2a150ca4fa8faca62c978221 (diff)
btrfs-progs: separate super_copy out of fs_info
Allocate fs_info::super_copy dynamically of full BTRFS_SUPER_INFO_SIZE and use it directly for saving superblock to disk. This fixes incorrect superblock checksum after mkfs. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'find-root.c')
-rw-r--r--find-root.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/find-root.c b/find-root.c
index 20ff9721..f99fb76f 100644
--- a/find-root.c
+++ b/find-root.c
@@ -147,7 +147,7 @@ static struct btrfs_root *open_ctree_broken(int fd, const char *device)
goto out_cleanup;
fs_info->super_bytenr = BTRFS_SUPER_INFO_OFFSET;
- disk_super = &fs_info->super_copy;
+ disk_super = fs_info->super_copy;
ret = btrfs_read_dev_super(fs_devices->latest_bdev,
disk_super, BTRFS_SUPER_INFO_OFFSET);
if (ret) {
@@ -234,10 +234,10 @@ out:
static int search_iobuf(struct btrfs_root *root, void *iobuf,
size_t iobuf_size, off_t offset)
{
- u64 gen = btrfs_super_generation(&root->fs_info->super_copy);
+ u64 gen = btrfs_super_generation(root->fs_info->super_copy);
u64 objectid = search_objectid;
- u32 size = btrfs_super_nodesize(&root->fs_info->super_copy);
- u8 level = root->fs_info->super_copy.root_level;
+ u32 size = btrfs_super_nodesize(root->fs_info->super_copy);
+ u8 level = root->fs_info->super_copy->root_level;
size_t block_off = 0;
while (block_off < iobuf_size) {
@@ -322,8 +322,8 @@ static int find_root(struct btrfs_root *root)
int ret = 1;
printf("Super think's the tree root is at %Lu, chunk root %Lu\n",
- btrfs_super_root(&root->fs_info->super_copy),
- btrfs_super_chunk_root(&root->fs_info->super_copy));
+ btrfs_super_root(root->fs_info->super_copy),
+ btrfs_super_chunk_root(root->fs_info->super_copy));
err = btrfs_next_metadata(&root->fs_info->mapping_tree,
&metadata_offset, &metadata_size);
@@ -336,7 +336,7 @@ static int find_root(struct btrfs_root *root)
u64 type;
if (offset >
- btrfs_super_total_bytes(&root->fs_info->super_copy)) {
+ btrfs_super_total_bytes(root->fs_info->super_copy)) {
printf("Went past the fs size, exiting");
break;
}
@@ -426,7 +426,7 @@ int main(int argc, char **argv)
exit(1);
}
- csum_size = btrfs_super_csum_size(&root->fs_info->super_copy);
+ csum_size = btrfs_super_csum_size(root->fs_info->super_copy);
ret = find_root(root);
close_ctree(root);
return ret;