mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Bligh <alex@alex.org.uk>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	nbd-general@lists.sourceforge.net
Cc: Alex Bligh <alex@alex.org.uk>, Eric Blake <eblake@redhat.com>
Subject: Block layer - meaning of REQ_FUA on not write requests
Date: Fri, 1 Apr 2016 16:27:35 +0100	[thread overview]
Message-ID: <FA28BBF6-1D91-4F9B-99DF-5C46F27E2D44@alex.org.uk> (raw)

I am trying to clean up the documentation of the NBD protocol. NBD's
support for Force Unit Access (FUA) was modelled on the linux kernel
block layer. When I added support a few years ago, I omitted to find
out exactly what types of request it applies to. Obviously it applies
to write requests, but how about others (e.g. read)?

https://www.kernel.org/doc/Documentation/block/writeback_cache_control.txt

seems somewhat ambiguous. It says

> The REQ_FUA flag can be OR ed into the r/w flags of a bio submitted from the
> filesystem and will make sure that I/O completion for this request is only
> signaled after the data has been committed to non-volatile storage.

and

> For devices that also support the FUA bit the block layer needs
> to be told to pass through the REQ_FUA bit using:
> 
> 	blk_queue_flush(sdkp->disk->queue, REQ_FLUSH | REQ_FUA);
> 
> and the driver must handle write requests that have the REQ_FUA bit set
> in prep_fn/request_fn.  If the FUA bit is not natively supported the block
> layer turns it into an empty REQ_FLUSH request after the actual write.

I can see four possible interpretations for reads:

1. REQ_FUA is not permitted on requests other than write, and it is an
   error to include it.

2. REQ_FUA does nothing on requests other than writes, and whilst permitted
   is ignored.

3. REQ_FUA has the following meaning on read: that area of data referred
   to by the read must be written to persistent storage if it is dirty.

and the following which is not an interpretation of the above, but is
logical:

4. REQ_FUA means that any in-memory copy of the data to be read must be
   discarded and the data reread from persistent storage (in case it
   has been written to by another client, for instance).

What meaning does REQ_FUA have for reads? Similarly what meaning does
it have for other block layer requests (e.g. trim)?


-- 
Alex Bligh

             reply	other threads:[~2016-04-01 15:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 15:27 Alex Bligh [this message]
2016-04-01 16:06 ` Jeff Moyer

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=FA28BBF6-1D91-4F9B-99DF-5C46F27E2D44@alex.org.uk \
    --to=alex@alex.org.uk \
    --cc=eblake@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd-general@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®