From: Darrick J. Wong Date: Fri, 30 Jun 2023 00:39:44 +0000 (-0700) Subject: xfs: fix getfsmap reporting past the last rt extent X-Git-Tag: v6.6.7~2380^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d898137d789cac9ebe5eed9957e4cf25122ca524;p=platform%2Fkernel%2Flinux-starfive.git xfs: fix getfsmap reporting past the last rt extent The realtime section ends at the last rt extent. If the user configures the rt geometry with an extent size that is not an integer factor of the number of rt blocks, it's possible for there to be rt blocks past the end of the last rt extent. These tail blocks cannot ever be allocated and will cause corruption reports if the last extent coincides with the end of an rt bitmap block, so do not report consider them for the GETFSMAP output. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c index 9019181..6bd6ab5 100644 --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -529,7 +529,7 @@ __xfs_getfsmap_rtdev( uint64_t eofs; int error = 0; - eofs = XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks); + eofs = XFS_FSB_TO_BB(mp, mp->m_sb.sb_rextents * mp->m_sb.sb_rextsize); if (keys[0].fmr_physical >= eofs) return 0; start_rtb = XFS_BB_TO_FSBT(mp,