]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: add online scrub for superblock counters
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 24 Jul 2019 19:54:07 +0000 (15:54 -0400)
committerEric Sandeen <sandeen@redhat.com>
Wed, 24 Jul 2019 19:54:07 +0000 (15:54 -0400)
Source kernel commit: 75efa57d0bf5fcf650a183f0ce0dc011ba8c4bc8

Teach online scrub how to check the filesystem summary counters.  We use
the incore delalloc block counter along with the incore AG headers to
compute expected values for fdblocks, icount, and ifree, and then check
that the percpu counter is within a certain threshold of the expected
value.  This is done to avoid having to freeze or otherwise lock the
filesystem, which means that we're only checking that the counters are
fairly close, not that they're exactly correct.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_fs.h
libxfs/xfs_types.c
libxfs/xfs_types.h

index 8d50ccf8a760ece26340a62189d5dbdca5ee23d0..f1158a7966108e13e7540006038ef28797f11989 100644 (file)
@@ -599,9 +599,10 @@ struct xfs_scrub_metadata {
 #define XFS_SCRUB_TYPE_UQUOTA  21      /* user quotas */
 #define XFS_SCRUB_TYPE_GQUOTA  22      /* group quotas */
 #define XFS_SCRUB_TYPE_PQUOTA  23      /* project quotas */
+#define XFS_SCRUB_TYPE_FSCOUNTERS 24   /* fs summary counters */
 
 /* Number of scrub subcommands. */
-#define XFS_SCRUB_TYPE_NR      24
+#define XFS_SCRUB_TYPE_NR      25
 
 /* i: Repair this metadata. */
 #define XFS_SCRUB_IFLAG_REPAIR         (1 << 0)
index 715d2056ca935bf5a261b420e2ffc9f9a009d075..3243c45b03f848bc64c2736fa13c6ad37fbcbdf5 100644 (file)
@@ -185,7 +185,7 @@ xfs_verify_rtbno(
 }
 
 /* Calculate the range of valid icount values. */
-static void
+void
 xfs_icount_range(
        struct xfs_mount        *mp,
        unsigned long long      *min,
index c5a25403b4db40cd624b1431785f2b2c9bf32e6d..802b34cd10fe08fa8612274f46c7ab1007894762 100644 (file)
@@ -191,5 +191,7 @@ bool xfs_verify_dir_ino(struct xfs_mount *mp, xfs_ino_t ino);
 bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
 bool xfs_verify_icount(struct xfs_mount *mp, unsigned long long icount);
 bool xfs_verify_dablk(struct xfs_mount *mp, xfs_fileoff_t off);
+void xfs_icount_range(struct xfs_mount *mp, unsigned long long *min,
+               unsigned long long *max);
 
 #endif /* __XFS_TYPES_H__ */