Hi all, This series employs atomic extent swapping to enable safe reconstruction of directory data. Directory repair consists of five main parts: First, we walk the existing directory to salvage as many entries as we can, by adding them as new directory entries to the repair temp dir. Second, we validate the parent pointer found in the directory. If one was not found, we scan the entire filesystem looking for a potential parent. Third, we prepare the temp file by changing the inode owner field in the directory block headers. Fourth, we use atomic extent swaps to exchange the entire data fork between the two directories. Finally, we add the ability to inactivate directories by directly freeing all the data fork blocks. This does not change anything with normal directories, since they must still unlink and shrink one entry at a time. If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below. This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-dirs --- fs/xfs/Makefile | 2 fs/xfs/scrub/common.c | 4 fs/xfs/scrub/dir.c | 49 ++ fs/xfs/scrub/dir_repair.c | 1176 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/parent.c | 39 + fs/xfs/scrub/parent.h | 11 fs/xfs/scrub/parent_repair.c | 439 ++++++++++++++++ fs/xfs/scrub/repair.c | 166 ++++++ fs/xfs/scrub/repair.h | 6 fs/xfs/scrub/scrub.c | 10 fs/xfs/scrub/scrub.h | 4 fs/xfs/scrub/trace.h | 123 ++++ fs/xfs/xfs_inode.c | 55 ++ fs/xfs/xfs_inode.h | 1 14 files changed, 2077 insertions(+), 8 deletions(-) create mode 100644 fs/xfs/scrub/dir_repair.c create mode 100644 fs/xfs/scrub/parent.h create mode 100644 fs/xfs/scrub/parent_repair.c