On Fri, Sep 23, 2016 at 05:15:16PM +0000, Eric Haszlakiewicz wrote:
> On September 23, 2016 10:51:30 AM EDT, Warner Losh <i...@bsdimp.com> wrote:
> >All NCQ gives you is the ability to schedule multiple requests and
> >to get notification of their completion (perhaps out of order). There's
> >no coherency features are all in NCQ.
> 
> This seems like the key thing needed to avoid FUA: to implement fsync() you 
> just wait for notifications of completion to be received, and once you have 
> those for all requests pending when fsync was called, or started as part of 
> the fsync, then you're done.

The other key point is that -- unless SATA NCQ is radically different from
SCSI tagged queuing in a particularly stupid way -- the rules require all
"simple" tags to be completed before any "ordered" tag is completed.  That is,
ordered tags are barriers against all simple tags.

So, with the write cache disabled, you can use a single command with an
ordered tag to force all preceding commands to complete, but continue
issuing commands while that happens.

To me, this is considerably more elegant that assuming all commands will
"complete" only to the cache by default and then setting FUA for commands
where you can't tolerate that misbehavior -- and certainly better than
flushing the whole cache, which is roughly like blowing off your own head
because you have a pimple on your nose.  But, clearly, others disagree.

Thor

Reply via email to