[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZrK7GrDSebnXXzF6@dread.disaster.area>
Date: Wed, 7 Aug 2024 10:08:58 +1000
From: Dave Chinner <david@...morbit.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: John Garry <john.g.garry@...cle.com>, chandan.babu@...cle.com,
dchinner@...hat.com, hch@....de, viro@...iv.linux.org.uk,
brauner@...nel.org, jack@...e.cz, linux-xfs@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
catherine.hoang@...cle.com, martin.petersen@...cle.com
Subject: Re: [PATCH v3 11/14] xfs: Only free full extents for forcealign
On Tue, Aug 06, 2024 at 12:27:38PM -0700, Darrick J. Wong wrote:
> On Thu, Aug 01, 2024 at 04:30:54PM +0000, John Garry wrote:
> > Like we already do for rtvol, only free full extents for forcealign in
> > xfs_free_file_space().
> >
> > Reviewed-by: "Darrick J. Wong" <djwong@...nel.org> #earlier version
> > Signed-off-by: John Garry <john.g.garry@...cle.com>
> > ---
> > fs/xfs/xfs_bmap_util.c | 7 ++-----
> > fs/xfs/xfs_inode.c | 14 ++++++++++++++
> > fs/xfs/xfs_inode.h | 2 ++
> > 3 files changed, 18 insertions(+), 5 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> > index 60389ac8bd45..46eebecd7bba 100644
> > --- a/fs/xfs/xfs_bmap_util.c
> > +++ b/fs/xfs/xfs_bmap_util.c
> > @@ -854,11 +854,8 @@ xfs_free_file_space(
> > startoffset_fsb = XFS_B_TO_FSB(mp, offset);
> > endoffset_fsb = XFS_B_TO_FSBT(mp, offset + len);
> >
> > - /* We can only free complete realtime extents. */
> > - if (xfs_inode_has_bigrtalloc(ip)) {
> > - startoffset_fsb = xfs_rtb_roundup_rtx(mp, startoffset_fsb);
> > - endoffset_fsb = xfs_rtb_rounddown_rtx(mp, endoffset_fsb);
> > - }
> > + /* Free only complete extents. */
> > + xfs_roundin_to_alloc_fsbsize(ip, &startoffset_fsb, &endoffset_fsb);
>
> ...and then this becomes:
>
> /* We can only free complete allocation units. */
> startoffset_fsb = xfs_inode_roundup_alloc_unit(ip, startoffset_fsb);
> endoffset_fsb = xfs_inode_rounddown_alloc_unit(ip, endoffset_fsb);
I much prefer this (roundup/rounddown) to the "in/out" API.
-Dave.
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists