]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: remove superfluous arguments to xfs_rtrefcountbt_init_cursor xfs-generic-group-rebase
authorChristoph Hellwig <hch@lst.de>
Sat, 21 Sep 2024 14:08:12 +0000 (16:08 +0200)
committerChristoph Hellwig <hch@lst.de>
Sun, 22 Sep 2024 08:48:33 +0000 (10:48 +0200)
The mount structure and inode can be derived from the rtg.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_refcount.c
fs/xfs/libxfs/xfs_rtrefcount_btree.c
fs/xfs/libxfs/xfs_rtrefcount_btree.h
fs/xfs/scrub/common.c
fs/xfs/scrub/repair.c
fs/xfs/scrub/rmap_repair.c
fs/xfs/scrub/rtrefcount_repair.c
fs/xfs/xfs_fsmap.c
fs/xfs/xfs_reflink.c

index fe6e4263dab70582763941fd7cd3905ea7d2b9fc..69c772335e89bba2728d3da297f34da2e175c231 100644 (file)
@@ -1538,9 +1538,7 @@ xfs_rtrefcount_finish_one(
        if (rcur == NULL) {
                xfs_rtgroup_lock(rtg, XFS_RTGLOCK_REFCOUNT);
                xfs_rtgroup_trans_join(tp, rtg, XFS_RTGLOCK_REFCOUNT);
-               *pcur = rcur = xfs_rtrefcountbt_init_cursor(mp, tp, rtg,
-                               rtg->rtg_inodes[XFS_RTGI_REFCOUNT]);
-
+               *pcur = rcur = xfs_rtrefcountbt_init_cursor(tp, rtg);
                rcur->bc_refc.nr_ops = nr_ops;
                rcur->bc_refc.shape_changes = shape_changes;
        }
@@ -2116,8 +2114,7 @@ xfs_refcount_recover_cow_leftovers(
 
        if (isrt) {
                xfs_rtgroup_lock(to_rtg(xg), XFS_RTGLOCK_REFCOUNT);
-               cur = xfs_rtrefcountbt_init_cursor(mp, tp, to_rtg(xg),
-                               to_rtg(xg)->rtg_inodes[XFS_RTGI_REFCOUNT]);
+               cur = xfs_rtrefcountbt_init_cursor(tp, to_rtg(xg));
        } else {
                error = xfs_alloc_read_agf(to_perag(xg), tp, 0, &agbp);
                if (error)
index 0dda6a2b3e0110e9aa10a7c71c694fcc3e9fd3cb..07b69c5a30fa7fade5a12b3b21929e6b61ed3448 100644 (file)
@@ -45,12 +45,7 @@ static struct xfs_btree_cur *
 xfs_rtrefcountbt_dup_cursor(
        struct xfs_btree_cur    *cur)
 {
-       struct xfs_btree_cur    *new;
-
-       new = xfs_rtrefcountbt_init_cursor(cur->bc_mp, cur->bc_tp,
-                       to_rtg(cur->bc_group), cur->bc_ino.ip);
-
-       return new;
+       return xfs_rtrefcountbt_init_cursor(cur->bc_tp, to_rtg(cur->bc_group));
 }
 
 STATIC int
@@ -406,13 +401,12 @@ const struct xfs_btree_ops xfs_rtrefcountbt_ops = {
 /* Allocate a new rt refcount btree cursor. */
 struct xfs_btree_cur *
 xfs_rtrefcountbt_init_cursor(
-       struct xfs_mount        *mp,
        struct xfs_trans        *tp,
-       struct xfs_rtgroup      *rtg,
-       struct xfs_inode        *ip)
+       struct xfs_rtgroup      *rtg)
 {
+       struct xfs_inode        *ip = rtg->rtg_inodes[XFS_RTGI_REFCOUNT];
+       struct xfs_mount        *mp = rtg_mount(rtg);
        struct xfs_btree_cur    *cur;
-       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK);
 
        xfs_assert_ilocked(ip, XFS_ILOCK_SHARED | XFS_ILOCK_EXCL);
 
@@ -423,7 +417,7 @@ xfs_rtrefcountbt_init_cursor(
        cur->bc_refc.nr_ops = 0;
        cur->bc_refc.shape_changes = 0;
        cur->bc_group = xfs_group_hold(&rtg->rtg_group);
-       cur->bc_nlevels = be16_to_cpu(ifp->if_broot->bb_level) + 1;
+       cur->bc_nlevels = be16_to_cpu(ip->i_df.if_broot->bb_level) + 1;
        cur->bc_ino.forksize = xfs_inode_fork_size(ip, XFS_DATA_FORK);
        cur->bc_ino.whichfork = XFS_DATA_FORK;
        return cur;
index 484bd2b091a3084f3b5a343220140e04784710c6..a99b7a8aec86597393204e2966f9297d092ce901 100644 (file)
@@ -15,9 +15,8 @@ struct xfs_rtgroup;
 /* refcounts only exist on crc enabled filesystems */
 #define XFS_RTREFCOUNT_BLOCK_LEN       XFS_BTREE_LBLOCK_CRC_LEN
 
-struct xfs_btree_cur *xfs_rtrefcountbt_init_cursor(struct xfs_mount *mp,
-               struct xfs_trans *tp, struct xfs_rtgroup *rtg,
-               struct xfs_inode *ip);
+struct xfs_btree_cur *xfs_rtrefcountbt_init_cursor(struct xfs_trans *tp,
+               struct xfs_rtgroup *rtg);
 struct xfs_btree_cur *xfs_rtrefcountbt_stage_cursor(struct xfs_mount *mp,
                struct xfs_rtgroup *rtg, struct xfs_inode *ip,
                struct xbtree_ifakeroot *ifake);
index 5f6a0b688c9e0c6321b1d506bb72e5da46b11189..7df665ca0d85ebd21e0bcd81a58301f46d85d194 100644 (file)
@@ -799,8 +799,7 @@ xchk_rtgroup_lock(
                sr->rmap_cur = xfs_rtrmapbt_init_cursor(sc->tp, sr->rtg);
 
        if (xfs_has_rtreflink(sc->mp) && (rtglock_flags & XFS_RTGLOCK_REFCOUNT))
-               sr->refc_cur = xfs_rtrefcountbt_init_cursor(sc->mp, sc->tp,
-                               sr->rtg, sr->rtg->rtg_inodes[XFS_RTGI_REFCOUNT]);
+               sr->refc_cur = xfs_rtrefcountbt_init_cursor(sc->tp, sr->rtg);
 
        return 0;
 }
@@ -1712,8 +1711,7 @@ xchk_inode_count_blocks(
                        ASSERT(0);
                        return -EFSCORRUPTED;
                }
-               cur = xfs_rtrefcountbt_init_cursor(sc->mp, sc->tp, sc->sr.rtg,
-                               sc->ip);
+               cur = xfs_rtrefcountbt_init_cursor(sc->tp, sc->sr.rtg);
                goto meta_btree;
        }
 
index 14d56ce4eddeef5c31fa1ac4e30af7ad329ff338..04067f56e4e1f6959ca04722b340fa6f7b8c0a38 100644 (file)
@@ -1012,9 +1012,7 @@ xrep_rtgroup_btcur_init(
        if (sc->sm->sm_type != XFS_SCRUB_TYPE_RTREFCBT &&
            (sr->rtlock_flags & XFS_RTGLOCK_REFCOUNT) &&
            xfs_has_rtreflink(mp))
-               sr->refc_cur = xfs_rtrefcountbt_init_cursor(mp, sc->tp,
-                                       sr->rtg,
-                                       sr->rtg->rtg_inodes[XFS_RTGI_REFCOUNT]);
+               sr->refc_cur = xfs_rtrefcountbt_init_cursor(sc->tp, sr->rtg);
 }
 
 /*
index a4cb96d675a3380027bc87c99461205ed4172887..b1773f30ba9c560d1ac408a5922b86073546db11 100644 (file)
@@ -548,8 +548,7 @@ xrep_rmap_scan_rtrefcountbt(
 
        while ((rtg = xfs_rtgroup_next(sc->mp, rtg))) {
                if (ip == rtg->rtg_inodes[XFS_RTGI_REFCOUNT]) {
-                       cur = xfs_rtrefcountbt_init_cursor(sc->mp, sc->tp, rtg,
-                                       ip);
+                       cur = xfs_rtrefcountbt_init_cursor(sc->tp, rtg);
                        error = xrep_rmap_scan_iroot_btree(rf, cur);
                        xfs_btree_del_cursor(cur, error);
                        xfs_rtgroup_rele(rtg);
index 837c880b7793c550957b82e552390b5495b5cdb9..4c4aafdf6f538d19ba17883bb2d07c784ac3b8fc 100644 (file)
@@ -638,8 +638,7 @@ xrep_rtrefc_build_new_tree(
        rr->new_btree.bload.claim_block = xrep_rtrefc_claim_block;
        rr->new_btree.bload.iroot_size = xrep_rtrefc_iroot_size;
 
-       refc_cur = xfs_rtrefcountbt_init_cursor(sc->mp, NULL, rtg,
-                       rtg->rtg_inodes[XFS_RTGI_REFCOUNT]);
+       refc_cur = xfs_rtrefcountbt_init_cursor(NULL, rtg);
        xfs_btree_stage_ifakeroot(refc_cur, &rr->new_btree.ifake);
 
        /* Compute how many blocks we'll need. */
index cc216f91f82a61a8e6002f2f0e4eaba3043cc475..6c2fc0bb6bf0e5651863109817258e74fcde522a 100644 (file)
@@ -219,15 +219,11 @@ xfs_getfsmap_is_shared(
        if (!xfs_has_reflink(mp) || !info->group)
                return 0;
 
-       if (info->group->xg_type == XG_TYPE_RTG) {
-               struct xfs_rtgroup      *rtg = to_rtg(info->group);
-
-               cur = xfs_rtrefcountbt_init_cursor(mp, tp, rtg,
-                               rtg->rtg_inodes[XFS_RTGI_REFCOUNT]);
-       } else {
+       if (info->group->xg_type == XG_TYPE_RTG)
+               cur = xfs_rtrefcountbt_init_cursor(tp, to_rtg(info->group));
+       else
                cur = xfs_refcountbt_init_cursor(mp, tp, info->agf_bp,
                                to_perag(info->group));
-       }
 
        /* Are there any shared blocks here? */
        error = xfs_refcount_find_shared(cur, frec->rec_key,
index 85358e63030c453f7296395a72ef64f1037d8a4b..3424fcbc2ef4330abc5beeb483b6ffcb2da0407a 100644 (file)
@@ -201,8 +201,7 @@ xfs_reflink_find_rtshared(
        rtg = xfs_rtgroup_get(mp, xfs_rtb_to_rgno(mp, irec->br_startblock));
 
        xfs_rtgroup_lock(rtg, XFS_RTGLOCK_REFCOUNT);
-       cur = xfs_rtrefcountbt_init_cursor(mp, tp, rtg,
-                       rtg->rtg_inodes[XFS_RTGI_REFCOUNT]);
+       cur = xfs_rtrefcountbt_init_cursor(tp, rtg);
        error = xfs_refcount_find_shared(cur, orig_bno, irec->br_blockcount,
                        &found_bno, shared_len, find_end_of_shared);
        xfs_btree_del_cursor(cur, error);