tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: WAPBL/cache flush and mfi(4)

On Fri, Aug 24, 2012 at 04:26:07PM -0400, Thor Lancelot Simon wrote:
> > I think in this case you have to flush both: if you flush only the
> > disks, the data you want to be on stable storage may still be in the
> > controller's cache.
> That doesn't make sense to me.  If you consider the controller cache
> to be stable storage, then you clearly need to flush only the disks'
> caches for all the data expected to be in stable storage to actually
> be in stable storage.

Immagine the following scenario:
- wapbl writes to its journal.
- mfi(4) sends the write to controller, which keeps it in its
  (battery-backed) cache and return completion of the command
- wapbl requests a cache flush
- mfi(4) translate this to a disk cache flush (but not controller cache
- the controller sends a cache flush to disk. at this time, the data wapbl
  cares about is still in the controller's cache
- some time later, the controller flushes its data to disks. Now the
  data from wapbl is in the unsafes disks caches, and not in the controller
  cache any more.

So you still need to flush the controller's cache before disks caches,
otherwise data can migrate from safe storage to unsafe one.

> With disks supporting tagged queueing, and reasonably smart controller
> firmware, there should be little advantage to running the disks with
> the write caches enabled anyway.

Sure, but with some PERC controllers it seems there's no option
(at last ine in the firmware's UI) to disable disk caches with SATA drives.
It may be different with SAS drives attached.

With the LSI 9265 I've been playing, there is such an option (you can choose
to disable, enable, or leave unchanged the disk write caches) but I've
only SAS drives attached. I don't know if the same options are available for

> Most controllers switch the cache to write-through mode themselves
> if they detect the battery has failed.

For LSI this is configurable ("write through", "always write back" and
"write back with BBU")

Manuel Bouyer <>
     NetBSD: 26 ans d'experience feront toujours la difference

Home | Main Index | Thread Index | Old Index