]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xfs: remove unnecessary null pointer checks from _read_agf callers
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 24 Jan 2020 01:01:20 +0000 (17:01 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Sun, 26 Jan 2020 22:32:27 +0000 (14:32 -0800)
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>
fs/xfs/libxfs/xfs_refcount.c
fs/xfs/scrub/agheader_repair.c
fs/xfs/scrub/fscounters.c
fs/xfs/scrub/repair.c
fs/xfs/xfs_discard.c
fs/xfs/xfs_reflink.c

index d7d702ee4d1a7e338bbfc89f57dbb1ae5b9ff29b..6e1665f2cb6732bba0714eff5541fd292d64fd96 100644 (file)
@@ -1177,8 +1177,6 @@ xfs_refcount_finish_one(
                                XFS_ALLOC_FLAG_FREEING, &agbp);
                if (error)
                        return error;
-               if (XFS_IS_CORRUPT(tp->t_mountp, !agbp))
-                       return -EFSCORRUPTED;
 
                rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
                if (!rcur) {
@@ -1718,10 +1716,6 @@ xfs_refcount_recover_cow_leftovers(
        error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
        if (error)
                goto out_trans;
-       if (!agbp) {
-               error = -ENOMEM;
-               goto out_trans;
-       }
        cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
 
        /* Find all the leftover CoW staging extents. */
index 7a1a38b636a91b20a7745ca42264cb68c88b2079..d5e6db9af434e836bfbc42f9ae076fbb2be86e41 100644 (file)
@@ -659,8 +659,6 @@ xrep_agfl(
        error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp);
        if (error)
                return error;
-       if (!agf_bp)
-               return -ENOMEM;
 
        /*
         * Make sure we have the AGFL buffer, as scrub might have decided it
@@ -735,8 +733,6 @@ xrep_agi_find_btrees(
        error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp);
        if (error)
                return error;
-       if (!agf_bp)
-               return -ENOMEM;
 
        /* Find the btree roots. */
        error = xrep_find_ag_btree_roots(sc, agf_bp, fab, NULL);
index 7251c66a82c9b465124e48a36b72374a78b47e91..ec2064ed3c30f4549de65a5726f8b14f1f177fd6 100644 (file)
@@ -83,9 +83,6 @@ xchk_fscount_warmup(
                error = xfs_alloc_read_agf(mp, sc->tp, agno, 0, &agf_bp);
                if (error)
                        break;
-               error = -ENOMEM;
-               if (!agf_bp || !agi_bp)
-                       break;
 
                /*
                 * These are supposed to be initialized by the header read
index 3df49d487940f8a527924e870263cee8b119cedf..e489d7a8446af16a33a2cacbf43897322c6ceee0 100644 (file)
@@ -546,8 +546,6 @@ xrep_reap_block(
                error = xfs_alloc_read_agf(sc->mp, sc->tp, agno, 0, &agf_bp);
                if (error)
                        return error;
-               if (!agf_bp)
-                       return -ENOMEM;
        } else {
                agf_bp = sc->sa.agf_bp;
        }
index cae6136201753ec3c693308111f040f92f7fa5ce..0b8350e84d28a9733dfa4db24e43c9537bc35143 100644 (file)
@@ -45,7 +45,7 @@ xfs_trim_extents(
        xfs_log_force(mp, XFS_LOG_SYNC);
 
        error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
-       if (error || !agbp)
+       if (error)
                goto out_put_perag;
 
        cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT);
index e723b267a24789e1fc3c49edf559b7667c838e61..b0ce04ffd3cd2ddeebc6db96dce35d61cd6413da 100644 (file)
@@ -143,8 +143,6 @@ xfs_reflink_find_shared(
        error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
        if (error)
                return error;
-       if (!agbp)
-               return -ENOMEM;
 
        cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);