]> www.infradead.org Git - users/hch/xfs.git/commitdiff
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 Feb 2025 04:49:12 +0000 (05:49 +0100)
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>
fs/xfs/xfs_super.c

index 5c1e01e928148fe0646752017fb87f8938b51b7a..34b0f5a80412e212acb404298444f51e8e6e18dd 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_resblks[XC_FREE_RTEXTENTS].total);
 }
 
 static void