path: root/ctree.h
diff options
authorQu Wenruo <>2015-01-02 15:12:29 +0800
committerDavid Sterba <>2015-02-02 14:16:38 +0100
commit0ddf63c09f2e24cd8f94e662c93055099fff2e2c (patch)
tree805256614f6ffce876b709d8f650c656cbe0aca5 /ctree.h
parent878affd47d20d3c781459fff022122d9a749449b (diff)
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 <> Signed-off-by: David Sterba <>
Diffstat (limited to 'ctree.h')
1 files changed, 10 insertions, 0 deletions
diff --git a/ctree.h b/ctree.h
index c069a95a..a8b99422 100644
--- a/ctree.h
+++ b/ctree.h
@@ -1039,6 +1039,16 @@ struct btrfs_root {
u64 highest_inode;
u64 last_inode_alloc;
+ /*
+ * Record orphan data extent ref
+ *
+ * TODO: Don't restore things in btrfs_root.
+ * Directly record it into inode_record, which needs a lot of
+ * infrastructure change to allow cooperation between extent
+ * and fs tree scan.
+ */
+ struct list_head orphan_data_extents;
/* the dirty list is only used by non-reference counted roots */
struct list_head dirty_list;
struct rb_node rb_node;