Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>

+1 -18
-6
fs/xfs/libxfs/xfs_refcount.c
··· 1177 1177 XFS_ALLOC_FLAG_FREEING, &agbp); 1178 1178 if (error) 1179 1179 return error; 1180 - if (XFS_IS_CORRUPT(tp->t_mountp, !agbp)) 1181 - return -EFSCORRUPTED; 1182 1180 1183 1181 rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno); 1184 1182 if (!rcur) { ··· 1716 1718 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); 1717 1719 if (error) 1718 1720 goto out_trans; 1719 - if (!agbp) { 1720 - error = -ENOMEM; 1721 - goto out_trans; 1722 - } 1723 1721 cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno); 1724 1722 1725 1723 /* Find all the leftover CoW staging extents. */
-4
fs/xfs/scrub/agheader_repair.c
··· 659 659 error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp); 660 660 if (error) 661 661 return error; 662 - if (!agf_bp) 663 - return -ENOMEM; 664 662 665 663 /* 666 664 * Make sure we have the AGFL buffer, as scrub might have decided it ··· 733 735 error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp); 734 736 if (error) 735 737 return error; 736 - if (!agf_bp) 737 - return -ENOMEM; 738 738 739 739 /* Find the btree roots. */ 740 740 error = xrep_find_ag_btree_roots(sc, agf_bp, fab, NULL);
-3
fs/xfs/scrub/fscounters.c
··· 83 83 error = xfs_alloc_read_agf(mp, sc->tp, agno, 0, &agf_bp); 84 84 if (error) 85 85 break; 86 - error = -ENOMEM; 87 - if (!agf_bp || !agi_bp) 88 - break; 89 86 90 87 /* 91 88 * These are supposed to be initialized by the header read
-2
fs/xfs/scrub/repair.c
··· 546 546 error = xfs_alloc_read_agf(sc->mp, sc->tp, agno, 0, &agf_bp); 547 547 if (error) 548 548 return error; 549 - if (!agf_bp) 550 - return -ENOMEM; 551 549 } else { 552 550 agf_bp = sc->sa.agf_bp; 553 551 }
+1 -1
fs/xfs/xfs_discard.c
··· 45 45 xfs_log_force(mp, XFS_LOG_SYNC); 46 46 47 47 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); 48 - if (error || !agbp) 48 + if (error) 49 49 goto out_put_perag; 50 50 51 51 cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT);
-2
fs/xfs/xfs_reflink.c
··· 143 143 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); 144 144 if (error) 145 145 return error; 146 - if (!agbp) 147 - return -ENOMEM; 148 146 149 147 cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno); 150 148