Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] xfs: avoid double deferrals for RWF_DONTCACHE writes
@ 2026-08-10 16:39 Tal Zussman
  2026-08-10 17:37 ` Christoph Hellwig
  2026-08-10 18:33 ` Darrick J. Wong
  0 siblings, 2 replies; 4+ messages in thread
From: Tal Zussman @ 2026-08-10 16:39 UTC (permalink / raw)
  To: Carlos Maiolino, Jens Axboe, Christoph Hellwig, Jan Kara
  Cc: linux-block, linux-xfs, linux-kernel, Tal Zussman

XFS already defers some writes to a workqueue when transactions are
needed to process the I/O completion. Disable the block layer bio task
completion in this case to avoid a major performance drop.

Fixes: efbde6f9f449 ("iomap: use BIO_COMPLETE_IN_TASK for dropbehind writeback")
Link: https://lore.kernel.org/all/8124341f-3af2-4a16-897d-38db5ab5a9d4@columbia.edu/
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
---
Follow-up fix for the RWF_DONTCACHE task-completion series. This is
targeting the block tree. [1]

[1]: https://lore.kernel.org/linux-block/annkDbhXBEeMoNVT@infradead.org/
---
 fs/xfs/xfs_aops.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index cd8de8c82d78..74a6089abadf 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -549,10 +549,14 @@ xfs_writeback_submit(
 	}
 
 	/*
-	 * Send ioends that might require a transaction to the completion wq.
+	 * Send ioends that might require a transaction to the completion wq,
+	 * and disable the block layer task completion for them as there is no
+	 * need to defer twice.
 	 */
-	if (xfs_ioend_needs_wq_completion(ioend))
+	if (xfs_ioend_needs_wq_completion(ioend)) {
 		ioend->io_bio.bi_end_io = xfs_end_bio;
+		bio_clear_flag(&ioend->io_bio, BIO_COMPLETE_IN_TASK);
+	}
 
 	return iomap_ioend_writeback_submit(wpc, error);
 }
@@ -663,7 +667,14 @@ xfs_zoned_writeback_submit(
 {
 	struct iomap_ioend		*ioend = wpc->wb_ctx;
 
+	/*
+	 * Defer all completions to our workqueue as all zoned writes require a
+	 * transaction to be persisted. This also means we never need the block
+	 * layer in-task completion for a task context.
+	 */
 	ioend->io_bio.bi_end_io = xfs_end_bio;
+	bio_clear_flag(&ioend->io_bio, BIO_COMPLETE_IN_TASK);
+
 	if (error) {
 		ioend->io_bio.bi_status = errno_to_blk_status(error);
 		bio_endio(&ioend->io_bio);

---
base-commit: 30df3ab3c92d0e7854c54df6ae66f4aa6eb5b3d2
change-id: 20260810-xfs-dontcache-double-defer-ae3fa50ba02c

Best regards,
-- 
Tal Zussman <tz2294@columbia.edu>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: avoid double deferrals for RWF_DONTCACHE writes
  2026-08-10 16:39 [PATCH] xfs: avoid double deferrals for RWF_DONTCACHE writes Tal Zussman
@ 2026-08-10 17:37 ` Christoph Hellwig
  2026-08-10 18:33 ` Darrick J. Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2026-08-10 17:37 UTC (permalink / raw)
  To: Tal Zussman
  Cc: Carlos Maiolino, Jens Axboe, Christoph Hellwig, Jan Kara,
	linux-block, linux-xfs, linux-kernel

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: avoid double deferrals for RWF_DONTCACHE writes
  2026-08-10 16:39 [PATCH] xfs: avoid double deferrals for RWF_DONTCACHE writes Tal Zussman
  2026-08-10 17:37 ` Christoph Hellwig
@ 2026-08-10 18:33 ` Darrick J. Wong
  2026-08-11 11:43   ` Tal Zussman
  1 sibling, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2026-08-10 18:33 UTC (permalink / raw)
  To: Tal Zussman
  Cc: Carlos Maiolino, Jens Axboe, Christoph Hellwig, Jan Kara,
	linux-block, linux-xfs, linux-kernel

On Mon, Aug 10, 2026 at 12:39:19PM -0400, Tal Zussman wrote:
> XFS already defers some writes to a workqueue when transactions are
> needed to process the I/O completion. Disable the block layer bio task
> completion in this case to avoid a major performance drop.
> 
> Fixes: efbde6f9f449 ("iomap: use BIO_COMPLETE_IN_TASK for dropbehind writeback")

What commit is this?

(If we're fixing something that's not in Linus' tree then I think the
fixes tags aren't required)

> Link: https://lore.kernel.org/all/8124341f-3af2-4a16-897d-38db5ab5a9d4@columbia.edu/
> Signed-off-by: Tal Zussman <tz2294@columbia.edu>
> ---
> Follow-up fix for the RWF_DONTCACHE task-completion series. This is
> targeting the block tree. [1]
> 
> [1]: https://lore.kernel.org/linux-block/annkDbhXBEeMoNVT@infradead.org/
> ---
>  fs/xfs/xfs_aops.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> index cd8de8c82d78..74a6089abadf 100644
> --- a/fs/xfs/xfs_aops.c
> +++ b/fs/xfs/xfs_aops.c
> @@ -549,10 +549,14 @@ xfs_writeback_submit(
>  	}
>  
>  	/*
> -	 * Send ioends that might require a transaction to the completion wq.
> +	 * Send ioends that might require a transaction to the completion wq,
> +	 * and disable the block layer task completion for them as there is no
> +	 * need to defer twice.
>  	 */
> -	if (xfs_ioend_needs_wq_completion(ioend))
> +	if (xfs_ioend_needs_wq_completion(ioend)) {
>  		ioend->io_bio.bi_end_io = xfs_end_bio;
> +		bio_clear_flag(&ioend->io_bio, BIO_COMPLETE_IN_TASK);
> +	}
>  
>  	return iomap_ioend_writeback_submit(wpc, error);
>  }
> @@ -663,7 +667,14 @@ xfs_zoned_writeback_submit(
>  {
>  	struct iomap_ioend		*ioend = wpc->wb_ctx;
>  
> +	/*
> +	 * Defer all completions to our workqueue as all zoned writes require a
> +	 * transaction to be persisted. This also means we never need the block
> +	 * layer in-task completion for a task context.
> +	 */
>  	ioend->io_bio.bi_end_io = xfs_end_bio;
> +	bio_clear_flag(&ioend->io_bio, BIO_COMPLETE_IN_TASK);

This makes sense to me;
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> +
>  	if (error) {
>  		ioend->io_bio.bi_status = errno_to_blk_status(error);
>  		bio_endio(&ioend->io_bio);
> 
> ---
> base-commit: 30df3ab3c92d0e7854c54df6ae66f4aa6eb5b3d2
> change-id: 20260810-xfs-dontcache-double-defer-ae3fa50ba02c
> 
> Best regards,
> -- 
> Tal Zussman <tz2294@columbia.edu>
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: avoid double deferrals for RWF_DONTCACHE writes
  2026-08-10 18:33 ` Darrick J. Wong
@ 2026-08-11 11:43   ` Tal Zussman
  0 siblings, 0 replies; 4+ messages in thread
From: Tal Zussman @ 2026-08-11 11:43 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Carlos Maiolino, Jens Axboe, Christoph Hellwig, Jan Kara,
	linux-block, linux-xfs, linux-kernel

On 8/10/26 2:33 PM, Darrick J. Wong wrote:
> On Mon, Aug 10, 2026 at 12:39:19PM -0400, Tal Zussman wrote:
>> XFS already defers some writes to a workqueue when transactions are
>> needed to process the I/O completion. Disable the block layer bio task
>> completion in this case to avoid a major performance drop.
>> 
>> Fixes: efbde6f9f449 ("iomap: use BIO_COMPLETE_IN_TASK for dropbehind writeback")
> 
> What commit is this?
> 

It's the following commit in the block tree's for-7.3/block branch:

https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git/commit/?h=for-7.3/block&id=efbde6f9f449da3306f5b5d32f08829954ffb44d

> (If we're fixing something that's not in Linus' tree then I think the
> fixes tags aren't required)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-11 11:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10 16:39 [PATCH] xfs: avoid double deferrals for RWF_DONTCACHE writes Tal Zussman
2026-08-10 17:37 ` Christoph Hellwig
2026-08-10 18:33 ` Darrick J. Wong
2026-08-11 11:43   ` Tal Zussman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox