Hi all, Now that we've created the infrastructure to perform live scans of every file in the filesystem and the necessary hook infrastructure to observe live updates, use it to scan directories to compute the correct link counts for files in the filesystem, and reset those link counts. This patchset creates a tailored readdir implementation for scrub because the regular version has to cycle ILOCKs to copy information to userspace. We can't cycle the ILOCK during the nlink scan and we don't need all the other VFS support code (maintaining a readdir cursor and translating XFS structures to VFS structures and back) so it was easier to duplicate the code. 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=scrub-nlinks xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=scrub-nlinks fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=scrub-nlinks --- fs/xfs/Makefile | 5 fs/xfs/libxfs/xfs_da_format.h | 11 fs/xfs/libxfs/xfs_dir2.c | 6 fs/xfs/libxfs/xfs_dir2.h | 1 fs/xfs/libxfs/xfs_fs.h | 4 fs/xfs/libxfs/xfs_health.h | 4 fs/xfs/scrub/common.c | 3 fs/xfs/scrub/common.h | 1 fs/xfs/scrub/dir.c | 173 ++------ fs/xfs/scrub/health.c | 1 fs/xfs/scrub/nlinks.c | 929 +++++++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/nlinks.h | 99 ++++ fs/xfs/scrub/nlinks_repair.c | 226 ++++++++++ fs/xfs/scrub/parent.c | 90 +--- fs/xfs/scrub/readdir.c | 375 +++++++++++++++++ fs/xfs/scrub/readdir.h | 19 + fs/xfs/scrub/repair.h | 2 fs/xfs/scrub/scrub.c | 9 fs/xfs/scrub/scrub.h | 5 fs/xfs/scrub/trace.c | 2 fs/xfs/scrub/trace.h | 193 ++++++++- fs/xfs/xfs_health.c | 1 fs/xfs/xfs_inode.c | 210 +++++++++ fs/xfs/xfs_inode.h | 35 ++ fs/xfs/xfs_mount.h | 2 fs/xfs/xfs_super.c | 2 fs/xfs/xfs_symlink.c | 1 27 files changed, 2219 insertions(+), 190 deletions(-) create mode 100644 fs/xfs/scrub/nlinks.c create mode 100644 fs/xfs/scrub/nlinks.h create mode 100644 fs/xfs/scrub/nlinks_repair.c create mode 100644 fs/xfs/scrub/readdir.c create mode 100644 fs/xfs/scrub/readdir.h