xfs: teach scrub to check file nlinks
authorDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:30:58 +0000 (12:30 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:30:58 +0000 (12:30 -0800)
commitf1184081ac97625d30c59851944f4c59ae7ddc2b
tree1995030ec381aaeea65e35ca27f9289b7a9831b1
parent93687ee2e3748a4a6b541ff0d83d1480815b00a9
xfs: teach scrub to check file nlinks

Create the necessary scrub code to walk the filesystem's directory tree
so that we can compute file link counts.  Similar to quotacheck, we
create an incore shadow array of link count information and then we walk
the filesystem a second time to compare the link counts.  We need live
updates to keep the information up to date during the lengthy scan, so
this scrubber remains disabled until the next patch.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/Makefile
fs/xfs/libxfs/xfs_fs.h
fs/xfs/scrub/common.h
fs/xfs/scrub/health.c
fs/xfs/scrub/nlinks.c [new file with mode: 0644]
fs/xfs/scrub/nlinks.h [new file with mode: 0644]
fs/xfs/scrub/scrub.c
fs/xfs/scrub/scrub.h
fs/xfs/scrub/stats.c
fs/xfs/scrub/trace.c
fs/xfs/scrub/trace.h