linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Alex Bligh <alex@alex.org.uk>, linux-fsdevel@vger.kernel.org
Subject: Re: Questions on block drivers, REQ_FLUSH and REQ_FUA
Date: Wed, 25 May 2011 10:59:50 +0200	[thread overview]
Message-ID: <20110525085950.GC10146@htj.dyndns.org> (raw)
In-Reply-To: <20110524223220.GA379@redhat.com>

Hey, Vivek.

On Tue, May 24, 2011 at 06:32:20PM -0400, Vivek Goyal wrote:
> I think documentation is fine. It specifically talks about completed
> requests. The requests which have been sent to drive (and may be in
> controller's cache). 
> 
> So in above example, if driver holds back WRITE1 and never signals
> the completion of request, then I think it is fine to complete
> the WRITE3+FLUSH ahead of WRITE1.

Yeap, that's correct.  Ordering between flush and other writes are now
completely the responsibility of filesystems.  Block layer just
doesn't care.

> I think issue will arise only if you signaled that WRITE1 has completed
> and cached it in driver (as you seem to indicating) and never sent to the
> drive and then you received WRITE3 + FLUSH requests. In that case you shall
> have to make sure that by the time WRITE3 + FLUSH completion is signaled,
> WRITE1 is on the disk.

A FLUSH command means "flush out all data from writes upto this
point".  If a driver has indicated completion of a write and then
received a FLUSH, the data from the write should be written to disk.

> > Again this does not appear to be illegal, as the FLUSH operation is
> > not defined as a barrier, meaning it should in theory be possible
> > to handle (and write to disk) requests received after the
> > FLUSH request before the FLUSH request finishes, provided that the
> > commands received before the FLUSH request itself complete before
> > the FLUSH request is replied to. I really don't know what the answer
> > is to this one. It makes a big difference to me as I can write multiple
> > blocks in parallel, and would really rather not slow up future write
> > requests until everything is flushed unless I need to.
> 
> IIUC, you are right. You can finish WRITE4 before completing FLUSH+WRITE3
> here.
> 
> We just need to make sure that any request completed by the driver
> is on disk by the time FLUSH+WRITE3 completes.

Yeap, again, block layer just doesn't care and the only thing block
driver should pay attention to regarding FLUSH is implementing FLUSH
command properly.

Thanks.

-- 
tejun

  parent reply	other threads:[~2011-05-25  8:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24 21:29 Questions on block drivers, REQ_FLUSH and REQ_FUA Alex Bligh
2011-05-24 22:32 ` Vivek Goyal
2011-05-24 22:37   ` Vivek Goyal
2011-05-25  8:06   ` Alex Bligh
2011-05-25  8:59   ` Tejun Heo [this message]
2011-05-25 15:54     ` Alex Bligh
2011-05-25 16:43       ` Tejun Heo
2011-05-25 17:43         ` Alex Bligh
2011-05-25 19:10           ` Vivek Goyal
2011-05-25 19:58             ` Alex Bligh
2011-05-25 19:15         ` Vivek Goyal

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=20110525085950.GC10146@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=alex@alex.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=vgoyal@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;
as well as URLs for NNTP newsgroup(s).