xfs: hoist rmap record flag checks from scrub
authorDarrick J. Wong <djwong@kernel.org>
Wed, 12 Apr 2023 02:00:06 +0000 (19:00 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 12 Apr 2023 02:00:06 +0000 (19:00 -0700)
Move the rmap record flag checks from xchk_rmapbt_rec into
xfs_rmap_check_irec so that they are applied everywhere.

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

index e66ecd7..da008d3 100644 (file)
@@ -254,6 +254,11 @@ xfs_rmap_check_irec(
        if (!is_inode && (is_bmbt || is_unwritten || is_attr))
                return __this_address;
 
+       /* Check for a valid fork offset, if applicable. */
+       if (is_inode && !is_bmbt &&
+           !xfs_verify_fileext(mp, irec->rm_offset, irec->rm_blockcount))
+               return __this_address;
+
        return NULL;
 }