Commit 819f29cc authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Carlos Maiolino
Browse files

xfs: always complete the buffer inline in xfs_buf_submit



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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Acked-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent 6dca5abb
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -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;

	xfs_buf_submit_bio(bp);
	if (xfs_buftarg_is_mem(bp->b_target)) {
		xfs_buf_ioend(bp);
		return;
	}

done:
	if (bp->b_error || !(bp->b_flags & XBF_ASYNC))
		xfs_buf_ioend(bp);
	else
		xfs_buf_ioend_async(bp);
	xfs_buf_submit_bio(bp);
}

void *