Skip to content

Commit 706b8c5

Browse files
committed
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: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent f48e2df commit 706b8c5

File tree

6 files changed

+1
-18
lines changed

6 files changed

+1
-18
lines changed

fs/xfs/libxfs/xfs_refcount.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,6 @@ xfs_refcount_finish_one(
11771177
XFS_ALLOC_FLAG_FREEING, &agbp);
11781178
if (error)
11791179
return error;
1180-
if (XFS_IS_CORRUPT(tp->t_mountp, !agbp))
1181-
return -EFSCORRUPTED;
11821180

11831181
rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
11841182
if (!rcur) {
@@ -1718,10 +1716,6 @@ xfs_refcount_recover_cow_leftovers(
17181716
error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
17191717
if (error)
17201718
goto out_trans;
1721-
if (!agbp) {
1722-
error = -ENOMEM;
1723-
goto out_trans;
1724-
}
17251719
cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
17261720

17271721
/* Find all the leftover CoW staging extents. */

fs/xfs/scrub/agheader_repair.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,6 @@ xrep_agfl(
659659
error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp);
660660
if (error)
661661
return error;
662-
if (!agf_bp)
663-
return -ENOMEM;
664662

665663
/*
666664
* Make sure we have the AGFL buffer, as scrub might have decided it
@@ -735,8 +733,6 @@ xrep_agi_find_btrees(
735733
error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp);
736734
if (error)
737735
return error;
738-
if (!agf_bp)
739-
return -ENOMEM;
740736

741737
/* Find the btree roots. */
742738
error = xrep_find_ag_btree_roots(sc, agf_bp, fab, NULL);

fs/xfs/scrub/fscounters.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ xchk_fscount_warmup(
8383
error = xfs_alloc_read_agf(mp, sc->tp, agno, 0, &agf_bp);
8484
if (error)
8585
break;
86-
error = -ENOMEM;
87-
if (!agf_bp || !agi_bp)
88-
break;
8986

9087
/*
9188
* These are supposed to be initialized by the header read

fs/xfs/scrub/repair.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,6 @@ xrep_reap_block(
546546
error = xfs_alloc_read_agf(sc->mp, sc->tp, agno, 0, &agf_bp);
547547
if (error)
548548
return error;
549-
if (!agf_bp)
550-
return -ENOMEM;
551549
} else {
552550
agf_bp = sc->sa.agf_bp;
553551
}

fs/xfs/xfs_discard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ xfs_trim_extents(
4545
xfs_log_force(mp, XFS_LOG_SYNC);
4646

4747
error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
48-
if (error || !agbp)
48+
if (error)
4949
goto out_put_perag;
5050

5151
cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT);

fs/xfs/xfs_reflink.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ xfs_reflink_find_shared(
143143
error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
144144
if (error)
145145
return error;
146-
if (!agbp)
147-
return -ENOMEM;
148146

149147
cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
150148

0 commit comments

Comments
 (0)