[PATCH 2/5] xfs_scrub: check file link counts

Darrick J. Wong
2024-03-26T03:59:29Z

From: Darrick J. Wong <djwong@kernel.org>

Check file link counts as part of checking a filesystem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
libfrog/scrub.c | 5 +++++
man/man2/ioctl_xfs_scrub_metadata.2 | 4 ++++
2 files changed, 9 insertions(+)

diff --git a/libfrog/scrub.c b/libfrog/scrub.c
index 53c47bc2b5dc..b6b8ae042c44 100644
--- a/libfrog/scrub.c
+++ b/libfrog/scrub.c
@@ -139,6 +139,11 @@ const struct xfrog_scrub_descr xfrog_scrubbers[XFS_SCRUB_TYPE_NR] = {
.descr = "quota counters",
.group = XFROG_SCRUB_GROUP_ISCAN,
},
+ [XFS_SCRUB_TYPE_NLINKS] = {
+ .name = "nlinks",
+ .descr = "inode link counts",
+ .group = XFROG_SCRUB_GROUP_ISCAN,
+ },
};

/* Invoke the scrub ioctl. Returns zero or negative error code. */
diff --git a/man/man2/ioctl_xfs_scrub_metadata.2 b/man/man2/ioctl_xfs_scrub_metadata.2
index 046e3e3657bb..8e8bb72fb3bf 100644
--- a/man/man2/ioctl_xfs_scrub_metadata.2
+++ b/man/man2/ioctl_xfs_scrub_metadata.2
@@ -164,6 +164,10 @@ Examine all user, group, or project quota records for corruption.
.B XFS_SCRUB_TYPE_FSCOUNTERS
Examine all filesystem summary counters (free blocks, inode count, free inode
count) for errors.
+
+.TP
+.B XFS_SCRUB_TYPE_NLINKS
+Scan all inodes in the filesystem to verify each file's link count.
.RE

.PD 1