ZFS: cache_flush_disable

Matt Churchyard matt.churchyard at userve.net
Wed Dec 19 15:10:44 UTC 2012


Can anyone give some knowledgeable info on the
vfs.zfs.cache_flush_disable variable? 
There's a lot of talk going on in the FreeBSD forums about how to get
the best performance but no-one really knows exactly what these settings
do (searching the net doesn't really find anyone who knows either).
There's a lot of mis-information going around as well and so I'd like to
start trying to get some concrete information if possible.

I'd like to know

1) What this setting actually does
2) If it's safe assuming you have battery backed ZIL (e.g. supercap SSD)

I am under the impression it controls whether ZFS asks disks to flush
their caches or not.
However, there's an entire function in zil.c (zil_add_block) that is
skipped when this flag is set. I'm not sure what this function does but
it seems to do more than just flush caches?

Regarding question 2, if this variable affects flushing of pool disks,
not just the ZIL, I can imagine a scenario where ZFS flushes a
transaction to the pool, but a power loss occurs while some of that data
is still sat in the disk cache. Usually ZFS would flush the cache and
only assume the write was complete at that point.
Assuming it affects all disks, is it possible to turn off write cache
per disk? I have seen hw.ata.wc but I'm not sure this still applies and
if it does it'll affect the ZIL which you'd want to leave enabled if it
was protected.

--
Matt


More information about the freebsd-fs mailing list