When a leaf/node is corrupted in fs root, btrfsck will only complain
like "Check tree block failed, wanted=XXX, have=XXX" and skip wrong
leaf.
Such case will cause a lot of err, one of these err will mainly be
I_ERR_NO_INODE_ITEM.

This patchset will info user which leaf of the tree is corrupted and try
it best to recovery the missing inode.
Although this is just a basis for the large use case of
corrupted-leaf/node repair, it is already working if the corrupted leaf
contains no extent data, not to mention the normal inode_item missing
case.

TODO: 
1. Cooperate with extent tree check/recover
   Current extent tree check will not record EXTENT_DATA extents, which
   can be used to improve the inode type recovery.

   Also extent tree repair can't handle EXTENT_DATA extents if the key
   can't be find and cause btrfsck exit.

   Need to cooperate with it to handle leaf recover better.

2. Add file extent recovery function
   In some case, even we recover the inode item, its file extents can
   still discount.
   To provide a fully repair making it pass btrfsck, we still need to
   repair such case.

3. Enhance inode_record
   Need a better inode_record to provide search function about
   inode_ref/dir_index/dir_item for given parent or child inode number,
   to help inode type detection and extent<->inode relation mapping for
   EXTENT_DATA.

Qu Wenruo (3):
  btrfs-progs: record and report leaf/node corruption in fs/subvol tree
  btrfs-progs:fsck: Recover btree with some corrupted leaf/node.
  btrfs-progs: Add inode item rebuild function.

 cmds-check.c | 328 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 ctree.c      |   3 +
 ctree.h      |   3 +
 inode.c      |   6 +-
 4 files changed, 323 insertions(+), 17 deletions(-)

-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to