Message ID | 20241211085636.1380516-31-hch@lst.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/43] xfs: constify feature checks | expand |
On Wed, Dec 11, 2024 at 09:54:55AM +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 b289b2ba78b1..59998aac7ed7 100644 > --- a/fs/xfs/xfs_super.c > +++ b/fs/xfs/xfs_super.c > @@ -865,7 +865,8 @@ xfs_statfs_rt( > xfs_sum_freecounter(mp, XC_FREE_RTEXTENTS); > > st->f_bfree = xfs_rtbxlen_to_blen(mp, max(0LL, freertx)); > - 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); I wonder, is mp->m_resblks[XC_FREE_RTEXTENTS].total considered "unavailable"? Should that be added to xfs_freecounter_unavailable? --D > } > > static void > -- > 2.45.2 > >
On Fri, Dec 13, 2024 at 02:43:58PM -0800, Darrick J. Wong wrote: > > - 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); > > I wonder, is mp->m_resblks[XC_FREE_RTEXTENTS].total considered > "unavailable"? Should that be added to xfs_freecounter_unavailable? That messed up the set_aside calculation in xfs_dec_freecounter and I think also xfs_reserve_blocks. I tried this early on in the project and it made a complete mess of the free block accounting.
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index b289b2ba78b1..59998aac7ed7 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -865,7 +865,8 @@ xfs_statfs_rt( xfs_sum_freecounter(mp, XC_FREE_RTEXTENTS); st->f_bfree = xfs_rtbxlen_to_blen(mp, max(0LL, freertx)); - 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
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(-)