Linux block layer
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Tal Zussman <tz2294@columbia.edu>
Cc: Jens Axboe <axboe@kernel.dk>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Christian Brauner <brauner@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	Carlos Maiolino <cem@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	Christoph Hellwig <hch@infradead.org>,
	Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>,
	Yue Hu <zbestahu@gmail.com>,
	Jeffle Xu <jefflexu@linux.alibaba.com>,
	Sandeep Dhavale <dhavale@google.com>,
	Hongbo Li <lihongbo22@huawei.com>,
	Chunhai Guo <guochunhai@vivo.com>, Dave Chinner <dgc@kernel.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Hillf Danton <hdanton@sina.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, linux-erofs@lists.ozlabs.org,
	Christoph Hellwig <hch@lst.de>
Subject: RWF_DONTCACHE regression fix for xfs
Date: Mon, 10 Aug 2026 07:45:33 -0700	[thread overview]
Message-ID: <annkDbhXBEeMoNVT@infradead.org> (raw)
In-Reply-To: <20260730-blk-dontcache-v7-0-3e8e6850068d@columbia.edu>

Below is Tal's suggested fixup for xfs with the whitespace damage fixeѕ.
It should probably be attributed to Tal instead.  Can you handled it
from here and send it to Jens with your signoff/authorship to avoid
the performance regression in XFS?

From: Christoph Hellwig <hch@lst.de>
Subject: xfs: avoid double deferrals for RWF_DONTCACHE writes

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")
---
 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 f73e26d9c9f9..059846a8d65c 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -372,10 +372,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);
 }
@@ -481,7 +485,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);
-- 
2.53.0


  parent reply	other threads:[~2026-08-10 14:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  6:57 [PATCH v7 0/5] block: enable RWF_DONTCACHE for block devices Tal Zussman
2026-07-30  6:57 ` [PATCH v7 1/5] block: introduce bio_in_atomic() Tal Zussman
2026-07-30  8:06   ` Christoph Hellwig
2026-07-30  9:02   ` Jan Kara
2026-07-30  6:57 ` [PATCH v7 2/5] block: add task-context bio completion infrastructure Tal Zussman
2026-07-30  8:09   ` Christoph Hellwig
2026-07-30  9:29   ` Jan Kara
2026-07-30  6:57 ` [PATCH v7 3/5] iomap: use BIO_COMPLETE_IN_TASK for dropbehind writeback Tal Zussman
2026-07-30  8:13   ` Christoph Hellwig
2026-07-30 20:39     ` Tal Zussman
2026-08-04 13:03       ` Christoph Hellwig
2026-07-30  6:57 ` [PATCH v7 4/5] buffer: set " Tal Zussman
2026-07-30  9:31   ` Jan Kara
2026-07-30  6:57 ` [PATCH v7 5/5] block: enable RWF_DONTCACHE for block devices Tal Zussman
2026-07-30  9:33   ` Jan Kara
2026-07-31 23:55   ` Tal Zussman
2026-07-31 15:01 ` [PATCH v7 0/5] " Jens Axboe
2026-08-10 14:45 ` Christoph Hellwig [this message]
2026-08-10 16:10   ` RWF_DONTCACHE regression fix for xfs Tal Zussman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=annkDbhXBEeMoNVT@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=bigeasy@linutronix.de \
    --cc=brauner@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=cem@kernel.org \
    --cc=chao@kernel.org \
    --cc=dgc@kernel.org \
    --cc=dhavale@google.com \
    --cc=djwong@kernel.org \
    --cc=guochunhai@vivo.com \
    --cc=hch@lst.de \
    --cc=hdanton@sina.com \
    --cc=jack@suse.cz \
    --cc=jefflexu@linux.alibaba.com \
    --cc=lihongbo22@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=tz2294@columbia.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=xiang@kernel.org \
    --cc=zbestahu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox