Commit 706b8c5b authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: remove unnecessary null pointer checks from _read_agf callers

Drop the null buffer pointer checks in all code that calls
xfs_alloc_read_agf and doesn't pass XFS_ALLOC_FLAG_TRYLOCK because
they're no longer necessary.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent f48e2df8
...@@ -1177,8 +1177,6 @@ xfs_refcount_finish_one( ...@@ -1177,8 +1177,6 @@ xfs_refcount_finish_one(
XFS_ALLOC_FLAG_FREEING, &agbp); XFS_ALLOC_FLAG_FREEING, &agbp);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(tp->t_mountp, !agbp))
return -EFSCORRUPTED;
rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno); rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
if (!rcur) { if (!rcur) {
...@@ -1718,10 +1716,6 @@ xfs_refcount_recover_cow_leftovers( ...@@ -1718,10 +1716,6 @@ xfs_refcount_recover_cow_leftovers(
error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
if (error) if (error)
goto out_trans; goto out_trans;
if (!agbp) {
error = -ENOMEM;
goto out_trans;
}
cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno); cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
/* Find all the leftover CoW staging extents. */ /* Find all the leftover CoW staging extents. */
......
...@@ -659,8 +659,6 @@ xrep_agfl( ...@@ -659,8 +659,6 @@ xrep_agfl(
error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp); error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp);
if (error) if (error)
return error; return error;
if (!agf_bp)
return -ENOMEM;
/* /*
* Make sure we have the AGFL buffer, as scrub might have decided it * Make sure we have the AGFL buffer, as scrub might have decided it
...@@ -735,8 +733,6 @@ xrep_agi_find_btrees( ...@@ -735,8 +733,6 @@ xrep_agi_find_btrees(
error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp); error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp);
if (error) if (error)
return error; return error;
if (!agf_bp)
return -ENOMEM;
/* Find the btree roots. */ /* Find the btree roots. */
error = xrep_find_ag_btree_roots(sc, agf_bp, fab, NULL); error = xrep_find_ag_btree_roots(sc, agf_bp, fab, NULL);
......
...@@ -83,9 +83,6 @@ xchk_fscount_warmup( ...@@ -83,9 +83,6 @@ xchk_fscount_warmup(
error = xfs_alloc_read_agf(mp, sc->tp, agno, 0, &agf_bp); error = xfs_alloc_read_agf(mp, sc->tp, agno, 0, &agf_bp);
if (error) if (error)
break; break;
error = -ENOMEM;
if (!agf_bp || !agi_bp)
break;
/* /*
* These are supposed to be initialized by the header read * These are supposed to be initialized by the header read
......
...@@ -546,8 +546,6 @@ xrep_reap_block( ...@@ -546,8 +546,6 @@ xrep_reap_block(
error = xfs_alloc_read_agf(sc->mp, sc->tp, agno, 0, &agf_bp); error = xfs_alloc_read_agf(sc->mp, sc->tp, agno, 0, &agf_bp);
if (error) if (error)
return error; return error;
if (!agf_bp)
return -ENOMEM;
} else { } else {
agf_bp = sc->sa.agf_bp; agf_bp = sc->sa.agf_bp;
} }
......
...@@ -45,7 +45,7 @@ xfs_trim_extents( ...@@ -45,7 +45,7 @@ xfs_trim_extents(
xfs_log_force(mp, XFS_LOG_SYNC); xfs_log_force(mp, XFS_LOG_SYNC);
error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
if (error || !agbp) if (error)
goto out_put_perag; goto out_put_perag;
cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT); cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT);
......
...@@ -143,8 +143,6 @@ xfs_reflink_find_shared( ...@@ -143,8 +143,6 @@ xfs_reflink_find_shared(
error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
if (error) if (error)
return error; return error;
if (!agbp)
return -ENOMEM;
cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno); cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment