Re: RWF_DONTCACHE regression fix for xfs
Tal Zussman <[email protected]> Mon, 10 Aug 2026 19:10:16 +0300
| Newsgroups | org.kernel.vger.linux-block,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-xfs,org.kvack.linux-mm,org.ozlabs.lists.linux-erofs |
|---|---|
| Message-ID | <[email protected]> |
On 8/10/26 10:45 AM, Christoph Hellwig wrote: > 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? > Yes, will do shortly. Thanks Christoph! > From: Christoph Hellwig <[email protected]> > 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 >