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. Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@xxxxxx>