btrfs-progs: fix btrfs-image old_restore fsck failure
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>
Thu, 26 Jun 2014 02:53:01 +0000 (10:53 +0800)
committerDavid Sterba <dsterba@suse.cz>
Fri, 22 Aug 2014 12:43:11 +0000 (14:43 +0200)
commit72ced9950a37f217a6f2377d7c557332185c413b
treeeffa8f360ffb3ca019071d9713463505c3b800ca
parent99ac0d5732668b95c3cab0ad20266562126d27f9
btrfs-progs: fix btrfs-image old_restore fsck failure

Steps to reproduce:
# mkfs.btrfs -f <dev1>
# btrfs-image <dev1> <image_file>
# btrfs-image -r -o <image_file> <dev2>
# btrfs check <dev2>

btrfs check output:
: read block failed check_tree_block
: Couldn't read tree root
: Couldn't open file system

The btrfs-image should not mess with the chunk tree under the old_restore way.

The new restore way was introduced by:
commit d6f7e3da0dae7b60cb7565f8a47c3b9045c52d1d
Btrfs-progs: make btrfs-image restore with a valid chunk tree V2
...
And the following commit enhanced the new restore on the valid chunk tree
building stuff:
commit ef2a8889ef813ba77061f6a92f4954d047a78932
Btrfs-progs: make image restore with the original device offsets
...

But the second commit should not effect the old_restore way since the
old_restore way doesn't try to build a valid chunk tree at all.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
btrfs-image.c