diff mbox series

[28/43] xfs: hide reserved RT blocks from statfs

Message ID 20250206064511.2323878-29-hch@lst.de (mailing list archive)
State Not Applicable, archived
Headers show
Series [01/43] xfs: factor out a xfs_rt_check_size helper | expand

Commit Message

Christoph Hellwig Feb. 6, 2025, 6:44 a.m. UTC
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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Darrick J. Wong Feb. 7, 2025, 4:32 a.m. UTC | #1
On Thu, Feb 06, 2025 at 07:44:44AM +0100, Christoph Hellwig wrote:
> 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 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 5c1e01e92814..34b0f5a80412 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -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);

Makes sense,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

>  }
>  
>  static void
> -- 
> 2.45.2
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 5c1e01e92814..34b0f5a80412 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -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