xfs: check quota files for unwritten extents
authorDarrick J. Wong <djwong@kernel.org>
Mon, 7 Nov 2022 01:03:21 +0000 (17:03 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 16 Nov 2022 23:25:04 +0000 (15:25 -0800)
Teach scrub to flag quota files containing unwritten extents.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/scrub/quota.c

index 0b643ff32b22216d3b98bb6af9f969ffe564780c..9eeac85653948b77160e75c3574c5c52a9c383ab 100644 (file)
@@ -14,6 +14,7 @@
 #include "xfs_inode.h"
 #include "xfs_quota.h"
 #include "xfs_qm.h"
+#include "xfs_bmap.h"
 #include "scrub/scrub.h"
 #include "scrub/common.h"
 
@@ -189,11 +190,12 @@ xchk_quota_data_fork(
        for_each_xfs_iext(ifp, &icur, &irec) {
                if (xchk_should_terminate(sc, &error))
                        break;
+
                /*
-                * delalloc extents or blocks mapped above the highest
+                * delalloc/unwritten extents or blocks mapped above the highest
                 * quota id shouldn't happen.
                 */
-               if (isnullstartblock(irec.br_startblock) ||
+               if (!xfs_bmap_is_written_extent(&irec) ||
                    irec.br_startoff > max_dqid_off ||
                    irec.br_startoff + irec.br_blockcount - 1 > max_dqid_off) {
                        xchk_fblock_set_corrupt(sc, XFS_DATA_FORK,