]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: remove the extra buffer reference in xfs_buf_submit
authorChristoph Hellwig <hch@lst.de>
Tue, 7 Jan 2025 18:42:27 +0000 (19:42 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 13 Jan 2025 04:17:37 +0000 (05:17 +0100)
Nothing touches the buffer after it has been submitted now, so the need for
the extra transient reference went away as well.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_buf.c

index ea0a0c344dd27e0e6454593efe8db5ba1c5669a0..4b75c7774f8b0e676ef6a086739c1f038b5f92a0 100644 (file)
@@ -1644,13 +1644,6 @@ xfs_buf_submit(
                return;
        }
 
-       /*
-        * Grab a reference so the buffer does not go away underneath us. For
-        * async buffers, I/O completion drops the callers reference, which
-        * could occur before submission returns.
-        */
-       xfs_buf_hold(bp);
-
        if (bp->b_flags & XBF_WRITE)
                xfs_buf_wait_unpin(bp);
 
@@ -1673,20 +1666,13 @@ xfs_buf_submit(
                goto done;
 
        xfs_buf_submit_bio(bp);
-       goto rele;
+       return;
 
 done:
        if (bp->b_error || !(bp->b_flags & XBF_ASYNC))
                xfs_buf_ioend(bp);
        else
                xfs_buf_ioend_async(bp);
-rele:
-       /*
-        * Release the hold that keeps the buffer referenced for the entire
-        * I/O. Note that if the buffer is async, it is not safe to reference
-        * after this release.
-        */
-       xfs_buf_rele(bp);
 }
 
 void *