From e99b0e9f91b51e1bdde347529cf35aa559d80b2b Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Wed, 3 Jul 2024 14:22:04 -0700 Subject: [PATCH] xfs: scrub each rtgroup's portion of the rtbitmap separately Create a new scrub type code so that userspace can scrub each rtgroup's portion of the rtbitmap file separately. This reduces the long tail latency that results from scanning the entire bitmap all at once, and prepares us for future patchsets, wherein we'll need to be able to lock a specific rtgroup so that we can rebuild that rtgroup's part of the rtbitmap contents from the rtgroup's rmap btree. Signed-off-by: Darrick J. Wong --- libfrog/scrub.c | 5 +++++ libxfs/xfs_fs.h | 4 +++- libxfs/xfs_health.h | 4 +++- man/man2/ioctl_xfs_scrub_metadata.2 | 12 ++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libfrog/scrub.c b/libfrog/scrub.c index e7fb8b890..351505f08 100644 --- a/libfrog/scrub.c +++ b/libfrog/scrub.c @@ -164,6 +164,11 @@ const struct xfrog_scrub_descr xfrog_scrubbers[XFS_SCRUB_TYPE_NR] = { .descr = "realtime group superblock", .group = XFROG_SCRUB_GROUP_RTGROUP, }, + [XFS_SCRUB_TYPE_RGBITMAP] = { + .name = "rgbitmap", + .descr = "realtime group bitmap", + .group = XFROG_SCRUB_GROUP_RTGROUP, + }, }; const struct xfrog_scrub_descr xfrog_metapaths[XFS_SCRUB_METAPATH_NR] = { diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h index 0dfc277d6..4a704432d 100644 --- a/libxfs/xfs_fs.h +++ b/libxfs/xfs_fs.h @@ -737,9 +737,10 @@ struct xfs_scrub_metadata { #define XFS_SCRUB_TYPE_DIRTREE 28 /* directory tree structure */ #define XFS_SCRUB_TYPE_METAPATH 29 /* metadata directory tree paths */ #define XFS_SCRUB_TYPE_RGSUPER 30 /* realtime superblock */ +#define XFS_SCRUB_TYPE_RGBITMAP 31 /* realtime group bitmap */ /* Number of scrub subcommands. */ -#define XFS_SCRUB_TYPE_NR 31 +#define XFS_SCRUB_TYPE_NR 32 /* * This special type code only applies to the vectored scrub implementation. @@ -985,6 +986,7 @@ struct xfs_rtgroup_geometry { __u64 rg_reserved[13]; /* o: zero */ }; #define XFS_RTGROUP_GEOM_SICK_SUPER (1U << 0) /* superblock */ +#define XFS_RTGROUP_GEOM_SICK_BITMAP (1U << 1) /* rtbitmap for this group */ /* * ioctl commands that are used by Linux filesystems diff --git a/libxfs/xfs_health.h b/libxfs/xfs_health.h index f08840632..5a35d4e7b 100644 --- a/libxfs/xfs_health.h +++ b/libxfs/xfs_health.h @@ -70,6 +70,7 @@ struct xfs_rtgroup; /* Observable health issues for realtime group metadata. */ #define XFS_SICK_RG_SUPER (1 << 0) /* rt group superblock */ +#define XFS_SICK_RG_BITMAP (1 << 1) /* rt group part of rtbitmap */ /* Observable health issues for AG metadata. */ #define XFS_SICK_AG_SB (1 << 0) /* superblock */ @@ -116,7 +117,8 @@ struct xfs_rtgroup; #define XFS_SICK_RT_PRIMARY (XFS_SICK_RT_BITMAP | \ XFS_SICK_RT_SUMMARY) -#define XFS_SICK_RG_PRIMARY (XFS_SICK_RG_SUPER) +#define XFS_SICK_RG_PRIMARY (XFS_SICK_RG_SUPER | \ + XFS_SICK_RG_BITMAP) #define XFS_SICK_AG_PRIMARY (XFS_SICK_AG_SB | \ XFS_SICK_AG_AGF | \ diff --git a/man/man2/ioctl_xfs_scrub_metadata.2 b/man/man2/ioctl_xfs_scrub_metadata.2 index 13f655e2b..dc439897c 100644 --- a/man/man2/ioctl_xfs_scrub_metadata.2 +++ b/man/man2/ioctl_xfs_scrub_metadata.2 @@ -97,6 +97,18 @@ The realtime allocation group number must be given in .IR sm_ino " and " sm_gen must be zero. +.PP +.TP +.B XFS_SCRUB_TYPE_RGBITMAP +Examine a given realtime allocation group's free space bitmap. +Records are checked for obviously incorrect values and cross-referenced +with other allocation group metadata records to ensure that there are no +conflicts. +The realtime allocation group number must be given in +.IR sm_agno "." +.IR sm_ino " and " sm_gen +must be zero. + .TP .B XFS_SCRUB_TYPE_INODE Examine a given inode record for obviously incorrect values and -- 2.50.1