On Fri, Mar 31, 2017 at 07:16:25PM +0200, Jarom??r Dole??ek wrote: > > The problem is that it does not always use SIMPLE and ORDERED tags in a > > way that would facilitate the use of ORDERED tags to enforce barriers. > > Our scsipi layer actually never issues ORDERED tags right now as far > as I can see, and there is currently no interface to get it set for an > I/O.
It's not obvious, but in fact ORDERED gets set for writes as a default, I believe -- in sd.c, I think? This confused me for some time when I last looked at it. > I lived under assumption that SIMPLE tagged commands could be and are > reordered by the controller/drive at will already, without setting any > other flags. They might be -- there are well defined mode page bits to control this, but I believe targets are free to use whatever default they like. > > > When SCSI tagged queueing is used properly, it is not necessary to set WCE > > to get good write performance, and doing so is in fact harmful, since it > > allows the drive to return ORDERED commands as complete before any of the > > data for those or prior commands have actually been committed to stable > > storage. > > This was what I meant when I said "even ordered tags couldn't avoid > the cache flushes". Using ORDERED tags doesn't provide on-media > integrity when WCE is set. Setting WCE on SCSI drives is simply a bad idea. It is not necessary for performance and creates data integrity isues. > Now, it might be the case that the on-media integrity is not the > primary goal. Then flush is only a write barrier, not integrity > measure. In that case yes, ORDERED does keep the semantics (e.g. > earlier journal writes are written before later journal writes). It > does make stuff much easier to code, too - simply mark I/O as ORDERED > and fire, no need to explicitly wait for competition, and can drop e.g > journal locks faster. > > I do think that it's important to concentrate on case where WCE is on, > since that is realistically what majority of systems run with. I don't believe most SCSI drives are run with WCE on. I agree FUA or its equivalent is needed for non-SCSI drives. Thor