From: Eric Wheeler <linux-block@lists.ewheeler.net>
To: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@infradead.org>,
Ming Lei <ming.lei@redhat.com>,
linux-block@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: loop: it looks like REQ_OP_FLUSH could return before IO completion.
Date: Sun, 17 Apr 2022 09:32:07 -0700 (PDT) [thread overview]
Message-ID: <d867fce8-e252-a621-cadb-c658dd2906a@ewheeler.net> (raw)
In-Reply-To: <7ae1f26a-cd09-85ff-2f4c-9e80af41ce66@kernel.dk>
On Sat, 16 Apr 2022, Jens Axboe wrote:
> On 4/16/22 2:05 PM, Eric Wheeler wrote:
> > On Fri, 15 Apr 2022, Christoph Hellwig wrote:
> >> On Fri, Apr 15, 2022 at 10:29:34PM +0800, Ming Lei wrote:
> >>> If ext4 expects the following order, it is ext4's responsibility to
> >>> maintain the order, and block layer may re-order all these IOs at will,
> >>> so do not expect IOs are issued to device in submission order
> >>
> >> Yes, and it has been so since REQ_FLUSH (which later became
> >> REQ_OP_FLUSH) replaced REQ_BARRIER 12 years ago:
> >>
> >> commit 28e7d1845216538303bb95d679d8fd4de50e2f1a
> >> Author: Tejun Heo <tj@kernel.org>
> >> Date: Fri Sep 3 11:56:16 2010 +0200
> >>
> >> block: drop barrier ordering by queue draining
> >>
> >> Filesystems will take all the responsibilities for ordering requests
> >> around commit writes and will only indicate how the commit writes
> >> themselves should be handled by block layers. This patch drops
> >> barrier ordering by queue draining from block layer.
> >
> > Thanks Christoph. I think this answers my original question, too.
> >
> > You may have already answered this implicitly above. If you would be so
> > kind as to confirm my or correct my understanding with a few more
> > questions:
> >
> > 1. Is the only way for a filesystem to know if one IO completed before a
> > second IO to track the first IO's completion and submit the second IO
> > when the first IO's completes (eg a journal commit followed by the
> > subsequent metadata update)? If not, then what block-layer mechanism
> > should be used?
>
> You either need to have a callback or wait on the IO, there's no other
> way.
>
> > 2. Are there any IO ordering flags or mechanisms in the block layer at
> > this point---or---is it simply that all IOs entering the block layer
> > can always be re-ordered before reaching the media?
>
> No, no ordering flags are provided for this kind of use case. Any IO can
> be reordered, hence the only reliable solution is to ensure the previous
> have completed.
Perfect, thanks Jens!
>
> --
> Jens Axboe
>
>
--
Eric Wheeler
prev parent reply other threads:[~2022-04-17 16:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <af3e552a-6c77-b295-19e1-d7a1e39b31f3@ewheeler.net>
[not found] ` <YjfFHvTCENCC29WS@T590>
[not found] ` <c03de7ac-63e9-2680-ca5b-8be62e4e177f@ewheeler.net>
[not found] ` <bd5f9817-c65e-7915-18b-9c68bb34488e@ewheeler.net>
[not found] ` <YldqnL79xH5NJGKW@T590>
[not found] ` <5b3cb173-484e-db3-8224-911a324de7dd@ewheeler.net>
2022-04-15 14:29 ` loop: it looks like REQ_OP_FLUSH could return before IO completion Ming Lei
2022-04-16 5:18 ` Christoph Hellwig
2022-04-16 20:05 ` Eric Wheeler
2022-04-17 0:59 ` Jens Axboe
2022-04-17 16:32 ` Eric Wheeler [this message]
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=d867fce8-e252-a621-cadb-c658dd2906a@ewheeler.net \
--to=linux-block@lists.ewheeler.net \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=ming.lei@redhat.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