From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>, Christian Brauner <brauner@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
"Darrick J. Wong" <djwong@kernel.org>,
Jens Axboe <axboe@kernel.dk>, Avi Kivity <avi@scylladb.com>,
Damien Le Moal <dlemoal@kernel.org>,
Naohiro Aota <naohiro.aota@wdc.com>,
Johannes Thumshirn <jth@kernel.org>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
io-uring@vger.kernel.org
Subject: Re: [PATCH 4/5] iomap: support write completions from interrupt context
Date: Thu, 13 Nov 2025 10:54:46 +0100 [thread overview]
Message-ID: <x76swsaqkkyko6oyjch2imsbqh3q3dx3uqqofjnktzbzfdkbhe@jog777bckvu6> (raw)
In-Reply-To: <20251113065055.GA29641@lst.de>
On Thu 13-11-25 07:50:55, Christoph Hellwig wrote:
> On Wed, Nov 12, 2025 at 09:25:58PM +0100, Jan Kara wrote:
> > > +
> > > + /*
> > > + * We can only do inline completion for pure overwrites that
> > > + * don't require additional I/O at completion time.
> > > + *
> > > + * This rules out writes that need zeroing or extent conversion,
> > > + * or extend the file size.
> > > + */
> > > + if (!iomap_dio_is_overwrite(iomap))
> > > + dio->flags &= ~IOMAP_DIO_INLINE_COMP;
> > > } else {
> > > bio_opf |= REQ_OP_READ;
> > > }
> >
> > OK, now I see why you wrote iomap_dio_is_overwrite() the way you did. You
> > still want to keep completions inline for overwrites of possibly
> > uncommitted extents.
>
> Yes.
>
> > But I have to admit it all seems somewhat fragile and
> > difficult to follow. Can't we just check for IOMAP_DIO_UNWRITTEN |
> > IOMAP_DIO_COW | IOMAP_DIO_NEED_SYNC in flags (plus the i_size check) and be
> > done with it?
>
> You mean drop the common helper? How would that be better and less
> fragile? Note that I care strongly, but I don't really see the point.
Sorry I was a bit terse. What I meant is that the two users of
iomap_dio_is_overwrite() actually care about different things and that
results in that function having a bit odd semantics IMHO. The first user
wants to figure out whether calling generic_write_sync() is needed upon io
completion to make data persistent (crash safe). The second user cares
whether we need to do metadata modifications upon io completion to make data
visible at all.
So it would be IMO more understandable if we had one helper like
iomap_dio_extent_stable() for the first case (which would be the same as
current iomap_dio_is_overwrite() + IOMAP_F_DIRTY) and for the second case
we already gather that information from extents in DIO flags and
filesystems do the non-trivial work in their end_io handlers based on these
flags so just checking IOMAP_DIO_UNWRITTEN | IOMAP_DIO_COW |
IOMAP_DIO_NEED_SYNC in iomap_dio_complete() should be a reliable trigger
for offloading to a workqueue (plus the check for dio->error). That way the
handling of IOMAP_DIO_INLINE_COMP happens only before we start IO (i_size
check) and in iomap_dio_complete() which seems easier to follow to me.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2025-11-13 9:54 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 7:21 enable iomap dio write completions from interrupt context Christoph Hellwig
2025-11-12 7:21 ` [PATCH 1/5] fs, iomap: remove IOCB_DIO_CALLER_COMP Christoph Hellwig
2025-11-12 19:59 ` Jan Kara
2025-11-13 0:00 ` Chaitanya Kulkarni
2025-11-12 7:21 ` [PATCH 2/5] iomap: always run error completions in user context Christoph Hellwig
2025-11-12 20:01 ` Jan Kara
2025-11-13 0:02 ` Chaitanya Kulkarni
2025-11-12 7:21 ` [PATCH 3/5] iomap: rework REQ_FUA selection Christoph Hellwig
2025-11-12 20:07 ` Jan Kara
2025-11-12 7:21 ` [PATCH 4/5] iomap: support write completions from interrupt context Christoph Hellwig
2025-11-12 20:25 ` Jan Kara
2025-11-13 6:50 ` Christoph Hellwig
2025-11-13 9:54 ` Jan Kara [this message]
2025-11-13 10:06 ` Christoph Hellwig
2025-11-13 12:06 ` Jan Kara
2025-11-13 12:35 ` Christoph Hellwig
2025-11-12 7:21 ` [PATCH 5/5] iomap: invert the polarity of IOMAP_DIO_INLINE_COMP Christoph Hellwig
2025-11-13 12:09 ` Jan Kara
2025-11-12 8:43 ` enable iomap dio write completions from interrupt context Damien Le Moal
2025-11-12 8:44 ` Christoph Hellwig
2025-11-12 8:46 ` Damien Le Moal
2025-11-13 9:58 ` Jan Kara
2025-11-13 10:05 ` Christoph Hellwig
2025-11-13 10:07 ` Damien Le Moal
2025-11-13 11:52 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2025-11-13 17:06 enable iomap dio write completions from interrupt context v2 Christoph Hellwig
2025-11-13 17:06 ` [PATCH 4/5] iomap: support write completions from interrupt context Christoph Hellwig
2025-11-24 11:11 ` Jan Kara
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=x76swsaqkkyko6oyjch2imsbqh3q3dx3uqqofjnktzbzfdkbhe@jog777bckvu6 \
--to=jack@suse.cz \
--cc=avi@scylladb.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=dlemoal@kernel.org \
--cc=hch@lst.de \
--cc=io-uring@vger.kernel.org \
--cc=jth@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
--cc=viro@zeniv.linux.org.uk \
/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