aboutsummaryrefslogtreecommitdiffstats
path: root/disk-io.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2015-01-02 15:12:29 +0800
committerDavid Sterba <dsterba@suse.cz>2015-02-02 14:16:38 +0100
commit0ddf63c09f2e24cd8f94e662c93055099fff2e2c (patch)
tree805256614f6ffce876b709d8f650c656cbe0aca5 /disk-io.c
parent878affd47d20d3c781459fff022122d9a749449b (diff)
downloadbtrfs-progs-0ddf63c09f2e24cd8f94e662c93055099fff2e2c.tar.gz
btrfs-progs-0ddf63c09f2e24cd8f94e662c93055099fff2e2c.tar.xz
btrfs-progs-0ddf63c09f2e24cd8f94e662c93055099fff2e2c.zip
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>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/disk-io.c b/disk-io.c
index 7f03790..d7b906a 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -374,6 +374,7 @@ int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
root->last_inode_alloc = 0;
INIT_LIST_HEAD(&root->dirty_list);
+ INIT_LIST_HEAD(&root->orphan_data_extents);
memset(&root->root_key, 0, sizeof(root->root_key));
memset(&root->root_item, 0, sizeof(root->root_item));
root->root_key.objectid = objectid;