From: Darrick J. Wong <djwong@xxxxxxxxxx> Make the bmap intent items take an active reference to the rtgroup containing the space that is being mapped or unmapped. We will need this functionality once we start enabling rmap and reflink on the rt volume. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- libxfs/defer_item.c | 17 +++++++++++++++-- libxfs/xfs_bmap.h | 5 ++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index 49e6cf02dc8..fbd035d9b94 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -492,8 +492,18 @@ xfs_bmap_update_get_group( { xfs_agnumber_t agno; - if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork)) + if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork)) { + if (xfs_has_rtgroups(mp)) { + xfs_rgnumber_t rgno; + + rgno = xfs_rtb_to_rgno(mp, bi->bi_bmap.br_startblock); + bi->bi_rtg = xfs_rtgroup_get(mp, rgno); + } else { + bi->bi_rtg = NULL; + } + return; + } agno = XFS_FSB_TO_AGNO(mp, bi->bi_bmap.br_startblock); @@ -524,8 +534,11 @@ static inline void xfs_bmap_update_put_group( struct xfs_bmap_intent *bi) { - if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork)) + if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork)) { + if (xfs_has_rtgroups(bi->bi_owner->i_mount)) + xfs_rtgroup_put(bi->bi_rtg); return; + } xfs_perag_intent_put(bi->bi_pag); } diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h index bd7f936262c..61c195198db 100644 --- a/libxfs/xfs_bmap.h +++ b/libxfs/xfs_bmap.h @@ -246,7 +246,10 @@ struct xfs_bmap_intent { enum xfs_bmap_intent_type bi_type; int bi_whichfork; struct xfs_inode *bi_owner; - struct xfs_perag *bi_pag; + union { + struct xfs_perag *bi_pag; + struct xfs_rtgroup *bi_rtg; + }; struct xfs_bmbt_irec bi_bmap; };