]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: remove superfluous arguments to xfs_rtrmapbt_init_cursor
authorChristoph Hellwig <hch@lst.de>
Sun, 22 Sep 2024 05:32:52 +0000 (07:32 +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_rmap.c
fs/xfs/libxfs/xfs_rtrmap_btree.c
fs/xfs/libxfs/xfs_rtrmap_btree.h
fs/xfs/scrub/bmap.c
fs/xfs/scrub/common.c
fs/xfs/scrub/reap.c
fs/xfs/scrub/repair.c
fs/xfs/scrub/rmap_repair.c
fs/xfs/scrub/rtrmap_repair.c
fs/xfs/xfs_fsmap.c

index 8993a19ce659eec0c56fe3510235edc806ca14f0..a8004bdcbda98ce3ab26882a5993bd0903cfee4e 100644 (file)
@@ -2672,8 +2672,7 @@ xfs_rtrmap_finish_init_cursor(
 
        xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP);
        xfs_rtgroup_trans_join(tp, rtg, XFS_RTGLOCK_RMAP);
-       *pcur = xfs_rtrmapbt_init_cursor(tp->t_mountp, tp, rtg,
-                       rtg->rtg_inodes[XFS_RTGI_RMAP]);
+       *pcur = xfs_rtrmapbt_init_cursor(tp, rtg);
        return 0;
 }
 
index fa2fe13362fcbe233182c5f9ff7a567276313ac7..a47a6c1b410c77b2e9bc0364020fbc4ccde66bb8 100644 (file)
@@ -47,12 +47,7 @@ static struct xfs_btree_cur *
 xfs_rtrmapbt_dup_cursor(
        struct xfs_btree_cur    *cur)
 {
-       struct xfs_btree_cur    *new;
-
-       new = xfs_rtrmapbt_init_cursor(cur->bc_mp, cur->bc_tp,
-                       to_rtg(cur->bc_group), cur->bc_ino.ip);
-
-       return new;
+       return xfs_rtrmapbt_init_cursor(cur->bc_tp, to_rtg(cur->bc_group));
 }
 
 STATIC int
@@ -530,13 +525,12 @@ const struct xfs_btree_ops xfs_rtrmapbt_ops = {
 /* Allocate a new rt rmap btree cursor. */
 struct xfs_btree_cur *
 xfs_rtrmapbt_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_RMAP];
+       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);
 
@@ -546,7 +540,7 @@ xfs_rtrmapbt_init_cursor(
        cur->bc_ino.ip = ip;
        cur->bc_group = xfs_group_hold(&rtg->rtg_group);
        cur->bc_ino.whichfork = XFS_DATA_FORK;
-       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);
 
        return cur;
@@ -1025,8 +1019,7 @@ xfs_rtrmapbt_init_rtsb(
        ASSERT(xfs_has_rtsb(mp));
        ASSERT(rtg_rgno(rtg) == 0);
 
-       cur = xfs_rtrmapbt_init_cursor(mp, tp, rtg,
-                       rtg->rtg_inodes[XFS_RTGI_RMAP]);
+       cur = xfs_rtrmapbt_init_cursor(tp, rtg);
        error = xfs_rmap_map_raw(cur, &rmap);
        xfs_btree_del_cursor(cur, error);
        return error;
index 999891142eee1e5523de71de1846fd25261ef16b..6a2d432b55ad78ecf238f2295189a805af3cd525 100644 (file)
@@ -16,9 +16,8 @@ struct xfbtree;
 /* rmaps only exist on crc enabled filesystems */
 #define XFS_RTRMAP_BLOCK_LEN   XFS_BTREE_LBLOCK_CRC_LEN
 
-struct xfs_btree_cur *xfs_rtrmapbt_init_cursor(struct xfs_mount *mp,
-               struct xfs_trans *tp, struct xfs_rtgroup *rtg,
-               struct xfs_inode *ip);
+struct xfs_btree_cur *xfs_rtrmapbt_init_cursor(struct xfs_trans *tp,
+               struct xfs_rtgroup *rtg);
 struct xfs_btree_cur *xfs_rtrmapbt_stage_cursor(struct xfs_mount *mp,
                struct xfs_rtgroup *rtg, struct xfs_inode *ip,
                struct xbtree_ifakeroot *ifake);
index 86085c98ef1e8d79c9cc8ff8120c274fb7886fb6..a9294ffb428c107cfcb3f76d0504df738a9ab69a 100644 (file)
@@ -726,9 +726,7 @@ xchk_bmap_check_rt_rmaps(
        int                             error;
 
        xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP);
-       cur = xfs_rtrmapbt_init_cursor(sc->mp, sc->tp, rtg,
-                       rtg->rtg_inodes[XFS_RTGI_RMAP]);
-
+       cur = xfs_rtrmapbt_init_cursor(sc->tp, rtg);
        sbcri.sc = sc;
        sbcri.whichfork = XFS_DATA_FORK;
        error = xfs_rmap_query_all(cur, xchk_bmap_check_rmap, &sbcri);
index 1ffdc28b8f414804e909d344c43f371e2f4b8c76..5f6a0b688c9e0c6321b1d506bb72e5da46b11189 100644 (file)
@@ -796,8 +796,7 @@ xchk_rtgroup_lock(
        sr->rtlock_flags = rtglock_flags;
 
        if (xfs_has_rtrmapbt(sc->mp) && (rtglock_flags & XFS_RTGLOCK_RMAP))
-               sr->rmap_cur = xfs_rtrmapbt_init_cursor(sc->mp, sc->tp,
-                               sr->rtg, sr->rtg->rtg_inodes[XFS_RTGI_RMAP]);
+               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,
@@ -1706,8 +1705,7 @@ xchk_inode_count_blocks(
                        ASSERT(0);
                        return -EFSCORRUPTED;
                }
-               cur = xfs_rtrmapbt_init_cursor(sc->mp, sc->tp, sc->sr.rtg,
-                               sc->ip);
+               cur = xfs_rtrmapbt_init_cursor(sc->tp, sc->sr.rtg);
                goto meta_btree;
        case XFS_DINODE_FMT_REFCOUNT:
                if (!sc->sr.rtg) {
index ac8e9096028b093b5498a5e1b242f423478e16a1..21c646446c74150fdc60e59492e161c261b743b9 100644 (file)
@@ -708,8 +708,7 @@ xreap_rgextent_select(
         * Determine if there are any other rmap records covering the first
         * block of this extent.  If so, the block is crosslinked.
         */
-       cur = xfs_rtrmapbt_init_cursor(sc->mp, sc->tp, sc->sr.rtg,
-                       sc->sr.rtg->rtg_inodes[XFS_RTGI_RMAP]);
+       cur = xfs_rtrmapbt_init_cursor(sc->tp, sc->sr.rtg);
        error = xfs_rmap_has_other_keys(cur, rgbno, 1, rs->oinfo,
                        crosslinked);
        if (error)
index e36de8c9af17ea09f67c555c6595195ab26f0255..14d56ce4eddeef5c31fa1ac4e30af7ad329ff338 100644 (file)
@@ -1007,8 +1007,7 @@ xrep_rtgroup_btcur_init(
        if (sc->sm->sm_type != XFS_SCRUB_TYPE_RTRMAPBT &&
            (sr->rtlock_flags & XFS_RTGLOCK_RMAP) &&
            xfs_has_rtrmapbt(mp))
-               sr->rmap_cur = xfs_rtrmapbt_init_cursor(mp, sc->tp, sr->rtg,
-                                       sr->rtg->rtg_inodes[XFS_RTGI_RMAP]);
+               sr->rmap_cur = xfs_rtrmapbt_init_cursor(sc->tp, sr->rtg);
 
        if (sc->sm->sm_type != XFS_SCRUB_TYPE_RTREFCBT &&
            (sr->rtlock_flags & XFS_RTGLOCK_REFCOUNT) &&
index 9217c9cfc8387bb266dc48cfb25eccd0f08ceefb..a4cb96d675a3380027bc87c99461205ed4172887 100644 (file)
@@ -517,7 +517,7 @@ xrep_rmap_scan_rtrmapbt(
 
        while ((rtg = xfs_rtgroup_next(sc->mp, rtg))) {
                if (ip == rtg->rtg_inodes[XFS_RTGI_RMAP]) {
-                       cur = xfs_rtrmapbt_init_cursor(sc->mp, sc->tp, rtg, ip);
+                       cur = xfs_rtrmapbt_init_cursor(sc->tp, rtg);
                        error = xrep_rmap_scan_iroot_btree(rf, cur);
                        xfs_btree_del_cursor(cur, error);
                        xfs_rtgroup_rele(rtg);
index bb704ecdc516d3cb98e40ee163e1f277048ac8fb..a688e0c24fb5d759ab204c3de3616d55e2e36d87 100644 (file)
@@ -730,8 +730,7 @@ xrep_rtrmap_build_new_tree(
        rr->new_btree.bload.claim_block = xrep_rtrmap_claim_block;
        rr->new_btree.bload.iroot_size = xrep_rtrmap_iroot_size;
 
-       rmap_cur = xfs_rtrmapbt_init_cursor(sc->mp, NULL, rtg,
-                       rtg->rtg_inodes[XFS_RTGI_RMAP]);
+       rmap_cur = xfs_rtrmapbt_init_cursor(NULL, rtg);
        xfs_btree_stage_ifakeroot(rmap_cur, &rr->new_btree.ifake);
 
        /* Compute how many blocks we'll need for the rmaps collected. */
index cfd2be7d60ea59e7fd90d7691255c9f6d3aa0271..cc216f91f82a61a8e6002f2f0e4eaba3043cc475 100644 (file)
@@ -864,7 +864,6 @@ xfs_getfsmap_rtdev_rmapbt_query(
        struct xfs_getfsmap_info        *info,
        struct xfs_btree_cur            **curpp)
 {
-       struct xfs_mount                *mp = tp->t_mountp;
        struct xfs_rtgroup              *rtg = to_rtg(info->group);
 
        /* Report any gap at the end of the last rtgroup. */
@@ -874,8 +873,7 @@ xfs_getfsmap_rtdev_rmapbt_query(
 
        /* Query the rtrmapbt */
        xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP | XFS_RTGLOCK_REFCOUNT);
-       *curpp = xfs_rtrmapbt_init_cursor(mp, tp, rtg,
-                       rtg->rtg_inodes[XFS_RTGI_RMAP]);
+       *curpp = xfs_rtrmapbt_init_cursor(tp, rtg);
        return xfs_rmap_query_range(*curpp, &info->low, &info->high,
                        xfs_getfsmap_rtdev_rmapbt_helper, info);
 }