Btrfs-progs: Add chunk recover function - using old chunk items
authorMiao Xie <miaox@cn.fujitsu.com>
Wed, 3 Jul 2013 13:25:17 +0000 (21:25 +0800)
committerChris Mason <chris.mason@fusionio.com>
Wed, 3 Jul 2013 18:06:55 +0000 (14:06 -0400)
commit30d5c8a49f088d76fb2806240393fc035ed75290
treef5a1652ad936c259f1cbc653a61384b3b2a31c2a
parent65534643f6e919c39f58bef31ebcffd48d8b1895
Btrfs-progs: Add chunk recover function - using old chunk items

Add chunk-recover program to check or rebuild chunk tree when the system
chunk array or chunk tree is broken.

Due to the importance of the system chunk array and chunk tree, if one of
them is broken, the whole btrfs will be broken even other data are OK.

But we have some hint(fsid, checksum...) to salvage the old metadata.
So this function will first scan the whole file system and collect the
needed data(chunk/block group/dev extent), and check for the references
between them. If the references are OK, the chunk tree can be rebuilt and
luckily the file system will be mountable.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
12 files changed:
Makefile
btrfs.c
btrfsck.h
cmds-check.c
cmds-chunk.c [new file with mode: 0644]
commands.h
disk-io.c
disk-io.h
extent-tree.c
extent_io.h
volumes.c
volumes.h