]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: always complete the buffer inline in xfs_buf_submit
authorChristoph Hellwig <hch@lst.de>
Mon, 13 Jan 2025 14:12:16 +0000 (15:12 +0100)
committerCarlos Maiolino <cem@kernel.org>
Tue, 14 Jan 2025 10:38:15 +0000 (11:38 +0100)
xfs_buf_submit now only completes a buffer on error, or for in-memory
buftargs.  There is no point in using a workqueue for the latter as
the completion will just wake up the caller.  Optimize this case by
avoiding the workqueue roundtrip.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Acked-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf.c

index 49d087d9ba485e601b7ec70c982750feef10a87f..8e795ccd57d6491ff2f486e3d44f6a57eed54166 100644 (file)
@@ -1657,21 +1657,17 @@ xfs_buf_submit(
 
        if ((bp->b_flags & XBF_WRITE) && !xfs_buf_verify_write(bp)) {
                xfs_force_shutdown(bp->b_mount, SHUTDOWN_CORRUPT_INCORE);
-               goto done;
+               xfs_buf_ioend(bp);
+               return;
        }
 
        /* In-memory targets are directly mapped, no I/O required. */
-       if (xfs_buftarg_is_mem(bp->b_target))
-               goto done;
+       if (xfs_buftarg_is_mem(bp->b_target)) {
+               xfs_buf_ioend(bp);
+               return;
+       }
 
        xfs_buf_submit_bio(bp);
-       return;
-
-done:
-       if (bp->b_error || !(bp->b_flags & XBF_ASYNC))
-               xfs_buf_ioend(bp);
-       else
-               xfs_buf_ioend_async(bp);
 }
 
 void *