btrfs-progs: Record orphan data extent ref to corresponding root.
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Fri, 2 Jan 2015 07:12:29 +0000 (15:12 +0800)
committerDavid Sterba <dsterba@suse.cz>
Mon, 2 Feb 2015 13:16:38 +0000 (14:16 +0100)
commit0ddf63c09f2e24cd8f94e662c93055099fff2e2c
tree805256614f6ffce876b709d8f650c656cbe0aca5
parent878affd47d20d3c781459fff022122d9a749449b
btrfs-progs: Record orphan data extent ref to corresponding root.

Before this patch, when a extent's data ref points to a invalid key in
fs tree, this happens if a leaf/node of fs tree is corrupted, btrfsck
can't do any repair and just exit.

In fact, such problem can be handled in fs tree repair routines, rebuild
the inode item(if missing) and add back the extent data (with some
assumption).

So this patch records such data extent refs for later fs tree recovery
routine.

TODO:
    Restore orphan data extent refs into btrfs_root is not the best
    method. It's best to directly restore it into inode_record, however
    current extent tree and fs tree can't cooperate together, so use
    btrfs_root as a temporary storage until inode_cache is built.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-check.c
ctree.h
disk-io.c