disk write barriers

Matthias Buelow mkb at incubus.de
Wed Jul 6 13:18:28 GMT 2005


Hi folks,

I'd like to know something about the (possible) existence of disk
write-barriers in FreeBSD. I often read the advice that one should
disable write-back caching on modern disks in order to make softupdates
actually work. Unfortunately, disabling the write-back cache on typical
ATA/SATA consumer disks involves a severe performance hit (my Seagate
SATA drive here drops to 1/5th sequential write speed, probably worse
for a random workload, and so this workaround isn't really an option.)

Now I've stumbled across: http://lkml.org/lkml/2005/5/15/88 in which
someone claims that FreeBSD "used ... write barriers long ago".
Write-barriers are a kind of synchronization point around critical
writes (i.e., those which need to be kept in a certain order), where the
block level drivers disable (or flush) the cache before the barrier, and
reenable it afterwards. Windows has been doing that for a long time in
order to make their NTFS halfway reliable (amazing that they got
something right). Linux apparently also has write-barriers, although for
SATA only in the most recent 2.6 kernels.

Now my question is: Does FreeBSD also implements these barriers, or an
equivalent mechanism, as claimed on the above URL? If it does, why then
the frequent advice to disable write-back caching? Or is that only for
the couple drives that ignore any flush cache/disable wb commands? I
know my drive doesn't ignore that command (since performance drops
sharply, when I disable the cache), so I would be on the safe side.
Would it be possible to get an authoritative statement from a FreeBSD
developer here on that matter?

Thanks.

mkb.


More information about the freebsd-questions mailing list