xfs: hide reserved RT blocks from statfs
authorChristoph Hellwig <hch@lst.de>
Mon, 16 Dec 2024 07:14:42 +0000 (08:14 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 3 Mar 2025 15:17:08 +0000 (08:17 -0700)
File systems with a zoned RT device have a large number of reserved
blocks that are required for garbage collection, and which can't be
filled with user data.  Exclude them from the available blocks reported
through stat(v)fs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
fs/xfs/xfs_super.c

index 39b2bad67fcde9337719bc87ce84b0c84ad4748f..b6426f5c8b51e601d24bd32fb90cc02679baf322 100644 (file)
@@ -869,7 +869,8 @@ xfs_statfs_rt(
 {
        st->f_bfree = xfs_rtbxlen_to_blen(mp,
                        xfs_sum_freecounter(mp, XC_FREE_RTEXTENTS));
-       st->f_blocks = mp->m_sb.sb_rblocks;
+       st->f_blocks = mp->m_sb.sb_rblocks - xfs_rtbxlen_to_blen(mp,
+                       mp->m_free[XC_FREE_RTEXTENTS].res_total);
 }
 
 static void