[SUMMARY] Introduce the new 'lost+found' dir and related infrastructure to create it in btrfs-progs.
[BUG] With the new infrastructure, fix a bug that some people reported in both kernel BZ and maillist, which there is some files' nlink is 1 but backref points to non-exist parent. The two reporters all report missing file(chrome config file), so we'd better not to delete such files but use the 'lost+found' dir. This bug is a kernel bug needing to be investigated, but the progs fix is here before kernel fix. [ROADMAP] 1. Fix the leaf corruption. Currently, btrfs-progs can ignore corrupt leaf and continue checking/reparing, however in that case, most problem can't be recovered since its parent is missing(in corrupted leaf) and we were not able to move them to someplace due to the missing of 'lost+found' dir. With this patchset, there is a hope to fix such problems and I will continue such work until we can fix most of most of the fs. 2. Unify the repair framework. When writing the 6th patch, I think it is better to build a frame work that unify the check and repair framework. In 6th patch, my patchset and Josef's commit 2dc4c001 in fact has some similar function but do the repair in different time and functions. I will try to build a unified framework for repair, each repair will be independent and have its own err number. And each repair function should work like the following: 1) Check the error number 2) Do the repair 3) Update the related btrfsck record(like newly created inode, deleted inode) Qu Wenruo (6): btrfs-progs: print root dir verbose error in fsck btrfs-progs: Import btrfs_insert/del/lookup_extref() functions. btrfs-progs: Import lookup/del_inode_ref() function. btrfs-progs: Add btrfs_unlink() and btrfs_add_link() functions. btrfs-progs: Add btrfs_mkdir() function for the incoming 'lost+found' fsck mechanism. btrfs-progs: Add fixing function for inodes whose nlink dismatch Makefile | 2 +- cmds-check.c | 284 +++++++++++++++++++++++++++++++++++-- ctree.c | 6 + ctree.h | 38 +++++ inode-item.c | 318 +++++++++++++++++++++++++++++++++++++++++ inode.c | 453 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1090 insertions(+), 11 deletions(-) create mode 100644 inode.c -- 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