Re: [PATCH 34/36] xfs: port the perag discard code to handle generic groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 14, 2024 at 01:12:40AM -0700, Christoph Hellwig wrote:
> On Thu, Oct 10, 2024 at 06:10:31PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@xxxxxxxxxx>
> > 
> > Port xfs_discard_extents and its tracepoints to handle generic groups
> > instead of just perags.  This is needed to enable busy extent tracking
> > for rtgroups.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> > ---
> >  fs/xfs/xfs_discard.c |   35 ++++++++++++++++++++++++++---------
> >  fs/xfs/xfs_trace.h   |   19 +++++++++++--------
> >  2 files changed, 37 insertions(+), 17 deletions(-)
> > 
> > 
> > diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
> > index bcc904e749b276..2200b119e55b6b 100644
> > --- a/fs/xfs/xfs_discard.c
> > +++ b/fs/xfs/xfs_discard.c
> > @@ -101,6 +101,24 @@ xfs_discard_endio(
> >  	bio_put(bio);
> >  }
> >  
> > +static inline struct block_device *
> > +xfs_group_bdev(
> > +	const struct xfs_group	*xg)
> > +{
> > +	struct xfs_mount	*mp = xg->xg_mount;
> > +
> > +	switch (xg->xg_type) {
> > +	case XG_TYPE_AG:
> > +		return mp->m_ddev_targp->bt_bdev;
> > +	case XG_TYPE_RTG:
> > +		return mp->m_rtdev_targp->bt_bdev;
> > +	default:
> > +		ASSERT(0);
> > +		break;
> > +	}
> > +	return NULL;
> > +}
> 
> I wonder if this should be in xfs_group.h as there is nothing
> discard-specific about it.

In userspace, mp->m_ddev_targp->bt_bdev is a type dev_t, so this can't
be hoisted to libxfs as-is.  If we ever grow a second caller then the
hoisted version would need to return the xfs_buftarg.  For now I'll
leave this as a static inline in the one file that needs it.

> Otherwise looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>

Thanks!

--D




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux