Subject: Re: write cache on ATA drives
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 12/10/2002 10:06:40
On Mon, Dec 09, 2002 at 06:11:41PM -0800, Jason R Thorpe wrote:
> On Mon, Dec 09, 2002 at 08:55:15PM -0500, Thor Lancelot Simon wrote:
> 
>  > The rule is simple:  ordered tags are performed in-order, and simple tags
>  > may be reordered, depending on the drive's configuration -- but all 
>  > outstanding simple tags must be completed before any ordered tag completes.
> 
> Right, I think this only means "command completion", however.  I'm not
> sure it means "data on platter".  This is why you want to use e.g.
> ORDERED with a SYNCHRONIZE CACHE command.

I can't quote you chapter and verse right now, but I've had it quoted at
me a number of times on this very subject.  If WCE is not set, command
completion is required to mean the data's on the platter -- no SYNCHRONIZE
CACHE required.

I think you want to be very careful about sending SYNCHRONIZE CACHE to
the drive if you don't have to; it can be quite expensive.  With tagged
queueing, you should not need to turn WCE on (which is good, because
it's dangerous) and thus you shouldn't need to send SYNCHRONIZE CACHE;
even simple tags are not supposed to be considered "complete" until the
data is on the platter,you can force all outstanding simples to complete 
by sending a single ordered, and you can let the drive arbitrarily
reorder the simples by setting its queueing policy appropriately in the
relevant mode page.

FWIW, I've seen a situation with an EMC array with multiple fibrechannel
interfaces and multiple LUNs using all available tags on all LUNs -- to 
the same host -- that had *gigabytes* of data pending at any one time.
It's pretty clear to me that tagged commands are an effective way to
give the drive enough data at once to do pretty much any optimization
it likes. :-)

(Of course, in that case, I also saw the array have to fail a command
 very early in the "in flight" data stream, which it correctly reported
 to the host, which was then _unable_, due to bugs, to roll-back the
 gigabytes of dependent VxFS transactions and trashed its filesystem.
 However, that's not the drive's fault. :-))

-- 
 Thor Lancelot Simon	                                      tls@rek.tjls.com
   But as he knew no bad language, he had called him all the names of common
 objects that he could think of, and had screamed: "You lamp!  You towel!  You
 plate!" and so on.              --Sigmund Freud