mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
xfs: drop unnecessary sr parameter from xchk_rtgroup init functions
Drop the sr parameter from the scrub rtgroup functions because the value is always the same. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
49869d5d03
commit
02c8e8d787
|
|
@ -329,13 +329,12 @@ xchk_bmap_rt_iextent_xref(
|
|||
int error;
|
||||
|
||||
error = xchk_rtgroup_init_existing(info->sc,
|
||||
xfs_rtb_to_rgno(ip->i_mount, irec->br_startblock),
|
||||
&info->sc->sr);
|
||||
xfs_rtb_to_rgno(ip->i_mount, irec->br_startblock));
|
||||
if (!xchk_fblock_process_error(info->sc, info->whichfork,
|
||||
irec->br_startoff, &error))
|
||||
return;
|
||||
|
||||
error = xchk_rtgroup_lock(info->sc, &info->sc->sr, XCHK_RTGLOCK_ALL);
|
||||
error = xchk_rtgroup_lock(info->sc, XCHK_RTGLOCK_ALL);
|
||||
if (!xchk_fblock_process_error(info->sc, info->whichfork,
|
||||
irec->br_startoff, &error))
|
||||
goto out_free;
|
||||
|
|
@ -373,9 +372,9 @@ xchk_bmap_rt_iextent_xref(
|
|||
break;
|
||||
}
|
||||
out_cur:
|
||||
xchk_rtgroup_btcur_free(&info->sc->sr);
|
||||
xchk_rtgroup_btcur_free(info->sc);
|
||||
out_free:
|
||||
xchk_rtgroup_free(info->sc, &info->sc->sr);
|
||||
xchk_rtgroup_free(info->sc);
|
||||
}
|
||||
|
||||
/* Cross-reference a single datadev extent record. */
|
||||
|
|
|
|||
|
|
@ -463,8 +463,8 @@ xrep_bmap_scan_rtgroup(
|
|||
return error;
|
||||
|
||||
error = xfs_rmap_query_all(sc->sr.rmap_cur, xrep_bmap_walk_rtrmap, rb);
|
||||
xchk_rtgroup_btcur_free(&sc->sr);
|
||||
xchk_rtgroup_free(sc, &sc->sr);
|
||||
xchk_rtgroup_btcur_free(sc);
|
||||
xchk_rtgroup_free(sc);
|
||||
return error;
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -730,9 +730,10 @@ xchk_ag_init(
|
|||
int
|
||||
xchk_rtgroup_init(
|
||||
struct xfs_scrub *sc,
|
||||
xfs_rgnumber_t rgno,
|
||||
struct xchk_rt *sr)
|
||||
xfs_rgnumber_t rgno)
|
||||
{
|
||||
struct xchk_rt *sr = &sc->sr;
|
||||
|
||||
ASSERT(sr->rtg == NULL);
|
||||
ASSERT(sr->rtlock_flags == 0);
|
||||
|
||||
|
|
@ -746,9 +747,9 @@ xchk_rtgroup_init(
|
|||
int
|
||||
xchk_rtgroup_lock(
|
||||
struct xfs_scrub *sc,
|
||||
struct xchk_rt *sr,
|
||||
unsigned int rtglock_flags)
|
||||
{
|
||||
struct xchk_rt *sr = &sc->sr;
|
||||
int error = 0;
|
||||
|
||||
ASSERT(sr->rtg != NULL);
|
||||
|
|
@ -831,8 +832,10 @@ xchk_rtgroup_lock(
|
|||
*/
|
||||
void
|
||||
xchk_rtgroup_btcur_free(
|
||||
struct xchk_rt *sr)
|
||||
struct xfs_scrub *sc)
|
||||
{
|
||||
struct xchk_rt *sr = &sc->sr;
|
||||
|
||||
if (sr->rmap_cur)
|
||||
xfs_btree_del_cursor(sr->rmap_cur, XFS_BTREE_ERROR);
|
||||
if (sr->refc_cur)
|
||||
|
|
@ -848,8 +851,10 @@ xchk_rtgroup_btcur_free(
|
|||
*/
|
||||
void
|
||||
xchk_rtgroup_unlock(
|
||||
struct xchk_rt *sr)
|
||||
struct xfs_scrub *sc)
|
||||
{
|
||||
struct xchk_rt *sr = &sc->sr;
|
||||
|
||||
ASSERT(sr->rtg != NULL);
|
||||
|
||||
if (sr->rtlock_flags) {
|
||||
|
|
@ -864,12 +869,13 @@ xchk_rtgroup_unlock(
|
|||
*/
|
||||
void
|
||||
xchk_rtgroup_free(
|
||||
struct xfs_scrub *sc,
|
||||
struct xchk_rt *sr)
|
||||
struct xfs_scrub *sc)
|
||||
{
|
||||
struct xchk_rt *sr = &sc->sr;
|
||||
|
||||
ASSERT(sr->rtg != NULL);
|
||||
|
||||
xchk_rtgroup_unlock(sr);
|
||||
xchk_rtgroup_unlock(sc);
|
||||
|
||||
xfs_rtgroup_put(sr->rtg);
|
||||
sr->rtg = NULL;
|
||||
|
|
|
|||
|
|
@ -135,32 +135,29 @@ xchk_ag_init_existing(
|
|||
XFS_RTGLOCK_RMAP | \
|
||||
XFS_RTGLOCK_REFCOUNT)
|
||||
|
||||
int xchk_rtgroup_init(struct xfs_scrub *sc, xfs_rgnumber_t rgno,
|
||||
struct xchk_rt *sr);
|
||||
int xchk_rtgroup_init(struct xfs_scrub *sc, xfs_rgnumber_t rgno);
|
||||
|
||||
static inline int
|
||||
xchk_rtgroup_init_existing(
|
||||
struct xfs_scrub *sc,
|
||||
xfs_rgnumber_t rgno,
|
||||
struct xchk_rt *sr)
|
||||
xfs_rgnumber_t rgno)
|
||||
{
|
||||
int error = xchk_rtgroup_init(sc, rgno, sr);
|
||||
int error = xchk_rtgroup_init(sc, rgno);
|
||||
|
||||
return error == -ENOENT ? -EFSCORRUPTED : error;
|
||||
}
|
||||
|
||||
int xchk_rtgroup_lock(struct xfs_scrub *sc, struct xchk_rt *sr,
|
||||
unsigned int rtglock_flags);
|
||||
void xchk_rtgroup_unlock(struct xchk_rt *sr);
|
||||
void xchk_rtgroup_btcur_free(struct xchk_rt *sr);
|
||||
void xchk_rtgroup_free(struct xfs_scrub *sc, struct xchk_rt *sr);
|
||||
int xchk_rtgroup_lock(struct xfs_scrub *sc, unsigned int rtglock_flags);
|
||||
void xchk_rtgroup_unlock(struct xfs_scrub *sc);
|
||||
void xchk_rtgroup_btcur_free(struct xfs_scrub *sc);
|
||||
void xchk_rtgroup_free(struct xfs_scrub *sc);
|
||||
#else
|
||||
# define xchk_rtgroup_init(sc, rgno, sr) (-EFSCORRUPTED)
|
||||
# define xchk_rtgroup_init_existing(sc, rgno, sr) (-EFSCORRUPTED)
|
||||
# define xchk_rtgroup_lock(sc, sr, lockflags) (-EFSCORRUPTED)
|
||||
# define xchk_rtgroup_unlock(sr) do { } while (0)
|
||||
# define xchk_rtgroup_btcur_free(sr) do { } while (0)
|
||||
# define xchk_rtgroup_free(sc, sr) do { } while (0)
|
||||
# define xchk_rtgroup_init(sc, rgno) (-EFSCORRUPTED)
|
||||
# define xchk_rtgroup_init_existing(sc, rgno) (-EFSCORRUPTED)
|
||||
# define xchk_rtgroup_lock(sc, lockflags) (-EFSCORRUPTED)
|
||||
# define xchk_rtgroup_unlock(sc) do { } while (0)
|
||||
# define xchk_rtgroup_btcur_free(sc) do { } while (0)
|
||||
# define xchk_rtgroup_free(sc) do { } while (0)
|
||||
#endif /* CONFIG_XFS_RT */
|
||||
|
||||
int xchk_ag_read_headers(struct xfs_scrub *sc, xfs_agnumber_t agno);
|
||||
|
|
|
|||
|
|
@ -433,8 +433,8 @@ xrep_cow_find_bad_rt(
|
|||
xc->irec.br_blockcount);
|
||||
|
||||
out_sr:
|
||||
xchk_rtgroup_btcur_free(&sc->sr);
|
||||
xchk_rtgroup_free(sc, &sc->sr);
|
||||
xchk_rtgroup_btcur_free(sc);
|
||||
xchk_rtgroup_free(sc);
|
||||
out_rtg:
|
||||
xfs_rtgroup_put(rtg);
|
||||
return error;
|
||||
|
|
|
|||
|
|
@ -822,8 +822,8 @@ xrep_dinode_count_rtgroup_rmaps(
|
|||
|
||||
error = xfs_rmap_query_all(sc->sr.rmap_cur, xrep_dinode_walk_rtrmap,
|
||||
ri);
|
||||
xchk_rtgroup_btcur_free(&sc->sr);
|
||||
xchk_rtgroup_free(sc, &sc->sr);
|
||||
xchk_rtgroup_btcur_free(sc);
|
||||
xchk_rtgroup_free(sc);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ xrep_attempt(
|
|||
trace_xrep_attempt(XFS_I(file_inode(sc->file)), sc->sm, error);
|
||||
|
||||
xchk_ag_btcur_free(sc);
|
||||
xchk_rtgroup_btcur_free(&sc->sr);
|
||||
xchk_rtgroup_btcur_free(sc);
|
||||
|
||||
/* Repair whatever's broken. */
|
||||
ASSERT(sc->ops->repair);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ xchk_rgsuperblock(
|
|||
* signal that the group no longer exists. Take the rtbitmap in shared
|
||||
* mode so that the group can't change while we're doing things.
|
||||
*/
|
||||
error = xchk_rtgroup_init_existing(sc, rgno, &sc->sr);
|
||||
error = xchk_rtgroup_init_existing(sc, rgno);
|
||||
if (!xchk_xref_process_error(sc, 0, 0, &error))
|
||||
return error;
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ xchk_rgsuperblock(
|
|||
else
|
||||
flags = XFS_RTGLOCK_BITMAP_SHARED;
|
||||
|
||||
error = xchk_rtgroup_lock(sc, &sc->sr, flags);
|
||||
error = xchk_rtgroup_lock(sc, flags);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ xchk_setup_rtbitmap(
|
|||
sc->buf = rtb;
|
||||
rtb->sc = sc;
|
||||
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno, &sc->sr);
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ xchk_setup_rtbitmap(
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = xchk_rtgroup_lock(sc, &sc->sr, XCHK_RTGLOCK_ALL);
|
||||
error = xchk_rtgroup_lock(sc, XCHK_RTGLOCK_ALL);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ xrep_rtbitmap_find_freespace(
|
|||
}
|
||||
|
||||
out:
|
||||
xchk_rtgroup_btcur_free(&sc->sr);
|
||||
xchk_rtgroup_btcur_free(sc);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ xchk_setup_rtrefcountbt(
|
|||
return error;
|
||||
}
|
||||
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno, &sc->sr);
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ xchk_setup_rtrefcountbt(
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
return xchk_rtgroup_lock(sc, &sc->sr, XCHK_RTGLOCK_ALL);
|
||||
return xchk_rtgroup_lock(sc, XCHK_RTGLOCK_ALL);
|
||||
}
|
||||
|
||||
/* Realtime Reference count btree scrubber. */
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ xrep_rtrefc_find_refcounts(
|
|||
out_bag:
|
||||
rcbag_free(&rcstack);
|
||||
out_cur:
|
||||
xchk_rtgroup_btcur_free(&sc->sr);
|
||||
xchk_rtgroup_btcur_free(sc);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ xchk_setup_rtrmapbt(
|
|||
return error;
|
||||
}
|
||||
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno, &sc->sr);
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ xchk_setup_rtrmapbt(
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
return xchk_rtgroup_lock(sc, &sc->sr, XCHK_RTGLOCK_ALL);
|
||||
return xchk_rtgroup_lock(sc, XCHK_RTGLOCK_ALL);
|
||||
}
|
||||
|
||||
/* Realtime reverse mapping. */
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ xrep_rtrmap_find_rmaps(
|
|||
/* Find CoW staging extents. */
|
||||
xrep_rtgroup_btcur_init(sc);
|
||||
error = xrep_rtrmap_find_refcount_rmaps(rr);
|
||||
xchk_rtgroup_btcur_free(&sc->sr);
|
||||
xchk_rtgroup_btcur_free(sc);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ xrep_rtrmap_find_rmaps(
|
|||
* do not take sb_internal.
|
||||
*/
|
||||
xchk_trans_cancel(sc);
|
||||
xchk_rtgroup_unlock(&sc->sr);
|
||||
xchk_rtgroup_unlock(sc);
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
while ((error = xchk_iscan_iter(&rr->iscan, &ip)) == 1) {
|
||||
|
|
@ -600,7 +600,7 @@ xrep_rtrmap_find_rmaps(
|
|||
error = xchk_setup_rt(sc);
|
||||
if (error)
|
||||
return error;
|
||||
error = xchk_rtgroup_lock(sc, &sc->sr, XCHK_RTGLOCK_ALL);
|
||||
error = xchk_rtgroup_lock(sc, XCHK_RTGLOCK_ALL);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ xchk_setup_rtsummary(
|
|||
return -ENOMEM;
|
||||
sc->buf = rts;
|
||||
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno, &sc->sr);
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ xchk_setup_rtsummary(
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = xchk_rtgroup_lock(sc, &sc->sr, XFS_RTGLOCK_BITMAP);
|
||||
error = xchk_rtgroup_lock(sc, XFS_RTGLOCK_BITMAP);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ xchk_teardown(
|
|||
int error)
|
||||
{
|
||||
xchk_ag_free(sc);
|
||||
xchk_rtgroup_btcur_free(&sc->sr);
|
||||
xchk_rtgroup_btcur_free(sc);
|
||||
|
||||
if (sc->tp) {
|
||||
if (error == 0 && (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR))
|
||||
|
|
@ -240,7 +240,7 @@ xchk_teardown(
|
|||
sc->tp = NULL;
|
||||
}
|
||||
if (sc->sr.rtg)
|
||||
xchk_rtgroup_free(sc, &sc->sr);
|
||||
xchk_rtgroup_free(sc);
|
||||
if (sc->ip) {
|
||||
if (sc->ilock_flags)
|
||||
xchk_iunlock(sc, sc->ilock_flags);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user