From f0346659db85b826c14392f9a627d845ab47b7e2 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Wed, 4 Jan 2012 10:36:41 -0500 Subject: [PATCH 38/43] Btrfs-progs: fix restore to actually use the root location if specified We were using the wrong variable for the root location if we specified -f when doing restore. Fix this. Thanks, Signed-off-by: Josef Bacik --- restore.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/restore.c b/restore.c index 95daef2..0b75902 100644 --- a/restore.c +++ b/restore.c @@ -871,13 +871,13 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location, int super_ return NULL; } if (!root_location) - bytenr = btrfs_super_root(&root->fs_info->super_copy); + root_location = btrfs_super_root(&root->fs_info->super_copy); blocksize = btrfs_level_size(root, btrfs_super_root_level(&root->fs_info->super_copy)); generation = btrfs_super_generation(&root->fs_info->super_copy); - root->fs_info->tree_root->node = read_tree_block(root, bytenr, + root->fs_info->tree_root->node = read_tree_block(root, root_location, blocksize, generation); if (!root->fs_info->tree_root->node) { @@ -895,7 +895,7 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location, int super_ root->fs_info->fs_root = btrfs_read_fs_root(root->fs_info, &key); if (IS_ERR(root->fs_info->fs_root)) { - fprintf(stderr, "Couldn't read fs_root: %ld\n", PTR_ERR(root)); + fprintf(stderr, "Couldn't read fs_root: %d\n", PTR_ERR(root)); close_ctree(root); return NULL; } -- 1.7.6.233.gd79bc