From: Christoph Hellwig Date: Sat, 21 Sep 2024 14:08:12 +0000 (+0200) Subject: xfs: remove superfluous arguments to xfs_rtrefcountbt_init_cursor X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fxfs-generic-group-rebase;p=users%2Fhch%2Fxfs.git xfs: remove superfluous arguments to xfs_rtrefcountbt_init_cursor The mount structure and inode can be derived from the rtg. Signed-off-by: Christoph Hellwig --- diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c index fe6e4263dab7..69c772335e89 100644 --- a/fs/xfs/libxfs/xfs_refcount.c +++ b/fs/xfs/libxfs/xfs_refcount.c @@ -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) diff --git a/fs/xfs/libxfs/xfs_rtrefcount_btree.c b/fs/xfs/libxfs/xfs_rtrefcount_btree.c index 0dda6a2b3e01..07b69c5a30fa 100644 --- a/fs/xfs/libxfs/xfs_rtrefcount_btree.c +++ b/fs/xfs/libxfs/xfs_rtrefcount_btree.c @@ -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; diff --git a/fs/xfs/libxfs/xfs_rtrefcount_btree.h b/fs/xfs/libxfs/xfs_rtrefcount_btree.h index 484bd2b091a3..a99b7a8aec86 100644 --- a/fs/xfs/libxfs/xfs_rtrefcount_btree.h +++ b/fs/xfs/libxfs/xfs_rtrefcount_btree.h @@ -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); diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c index 5f6a0b688c9e..7df665ca0d85 100644 --- a/fs/xfs/scrub/common.c +++ b/fs/xfs/scrub/common.c @@ -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; } diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c index 14d56ce4edde..04067f56e4e1 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c @@ -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); } /* diff --git a/fs/xfs/scrub/rmap_repair.c b/fs/xfs/scrub/rmap_repair.c index a4cb96d675a3..b1773f30ba9c 100644 --- a/fs/xfs/scrub/rmap_repair.c +++ b/fs/xfs/scrub/rmap_repair.c @@ -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); diff --git a/fs/xfs/scrub/rtrefcount_repair.c b/fs/xfs/scrub/rtrefcount_repair.c index 837c880b7793..4c4aafdf6f53 100644 --- a/fs/xfs/scrub/rtrefcount_repair.c +++ b/fs/xfs/scrub/rtrefcount_repair.c @@ -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. */ diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c index cc216f91f82a..6c2fc0bb6bf0 100644 --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -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, diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 85358e63030c..3424fcbc2ef4 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -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);