Skip to content

Commit 198febb

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: store a generic xfs_group pointer in xfs_getfsmap_info
Replace the pag and rtg pointers with a generic group pointer. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 77a530e commit 198febb

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

fs/xfs/xfs_fsmap.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ struct xfs_getfsmap_info {
158158
struct xfs_fsmap_head *head;
159159
struct fsmap *fsmap_recs; /* mapping records */
160160
struct xfs_buf *agf_bp; /* AGF, for refcount queries */
161-
struct xfs_perag *pag; /* AG info, if applicable */
161+
struct xfs_group *group; /* group info, if applicable */
162162
xfs_daddr_t next_daddr; /* next daddr we expect */
163163
/* daddr of low fsmap key when we're using the rtbitmap */
164164
xfs_daddr_t low_daddr;
@@ -216,12 +216,13 @@ xfs_getfsmap_is_shared(
216216
if (!xfs_has_reflink(mp))
217217
return 0;
218218
/* rt files will have no perag structure */
219-
if (!info->pag)
219+
if (!info->group)
220220
return 0;
221221

222222
/* Are there any shared blocks here? */
223223
flen = 0;
224-
cur = xfs_refcountbt_init_cursor(mp, tp, info->agf_bp, info->pag);
224+
cur = xfs_refcountbt_init_cursor(mp, tp, info->agf_bp,
225+
to_perag(info->group));
225226

226227
error = xfs_refcount_find_shared(cur, rec->rm_startblock,
227228
rec->rm_blockcount, &fbno, &flen, false);
@@ -353,7 +354,8 @@ xfs_getfsmap_helper(
353354
return -ECANCELED;
354355

355356
trace_xfs_fsmap_mapping(mp, info->dev,
356-
info->pag ? pag_agno(info->pag) : NULLAGNUMBER, rec);
357+
info->group ? info->group->xg_gno : NULLAGNUMBER,
358+
rec);
357359

358360
fmr.fmr_device = info->dev;
359361
fmr.fmr_physical = rec_daddr;
@@ -519,7 +521,7 @@ __xfs_getfsmap_datadev(
519521
* Set the AG high key from the fsmap high key if this
520522
* is the last AG that we're querying.
521523
*/
522-
info->pag = pag;
524+
info->group = pag_group(pag);
523525
if (pag_agno(pag) == end_ag) {
524526
info->high.rm_startblock = XFS_FSB_TO_AGBNO(mp,
525527
end_fsb);
@@ -569,7 +571,7 @@ __xfs_getfsmap_datadev(
569571
if (error)
570572
break;
571573
}
572-
info->pag = NULL;
574+
info->group = NULL;
573575
}
574576

575577
if (bt_cur)
@@ -579,9 +581,9 @@ __xfs_getfsmap_datadev(
579581
xfs_trans_brelse(tp, info->agf_bp);
580582
info->agf_bp = NULL;
581583
}
582-
if (info->pag) {
583-
xfs_perag_rele(info->pag);
584-
info->pag = NULL;
584+
if (info->group) {
585+
xfs_perag_rele(pag);
586+
info->group = NULL;
585587
} else if (pag) {
586588
/* loop termination case */
587589
xfs_perag_rele(pag);
@@ -604,7 +606,7 @@ xfs_getfsmap_datadev_rmapbt_query(
604606

605607
/* Allocate cursor for this AG and query_range it. */
606608
*curpp = xfs_rmapbt_init_cursor(tp->t_mountp, tp, info->agf_bp,
607-
info->pag);
609+
to_perag(info->group));
608610
return xfs_rmap_query_range(*curpp, &info->low, &info->high,
609611
xfs_getfsmap_datadev_helper, info);
610612
}
@@ -637,7 +639,7 @@ xfs_getfsmap_datadev_bnobt_query(
637639

638640
/* Allocate cursor for this AG and query_range it. */
639641
*curpp = xfs_bnobt_init_cursor(tp->t_mountp, tp, info->agf_bp,
640-
info->pag);
642+
to_perag(info->group));
641643
key->ar_startblock = info->low.rm_startblock;
642644
key[1].ar_startblock = info->high.rm_startblock;
643645
return xfs_alloc_query_range(*curpp, key, &key[1],
@@ -997,7 +999,7 @@ xfs_getfsmap(
997999

9981000
info.dev = handlers[i].dev;
9991001
info.last = false;
1000-
info.pag = NULL;
1002+
info.group = NULL;
10011003
info.low_daddr = XFS_BUF_DADDR_NULL;
10021004
info.low.rm_blockcount = 0;
10031005
error = handlers[i].fn(tp, dkeys, &info);

0 commit comments

Comments
 (0)