Subject: disks write-back cache
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 04/26/2003 18:05:27
Hi,
I just discovered that what I though about write-back disk cache on SCSI
devices was wrong:
1) although major unix vendors (tested Sun, DEC/compaq) ships SCSI disks
   with write-back cache disabled, disks manufacturer don't (I tested
   various models of SCSI disks coming from a local PC assembler).
2) write-back cache affects tagged queuing: with write-back cache enabled,
   scsi tagged commands can report status completion before the data
   are written to disk (discovered by experiment).

This cause problems for filesystems or applications that take measure to
prevent problems in case of unattended reboot (e.g. FFS, or sendmail).
Until today I though I was safe when using SCSI disks.
I think the kernel should print a warning when it probes a disk with the
write cache enabled.

I did some benchmarks here, and it seems tagged queuing mostly hide the
imrpovement of write-back cache. On two different filesystems (on top of
RAID-1 raidframe devices), I see a performance decrease of 2-5% writing
a 640MB file (tested on different servers, the decrease is dependant on the
disk model, and maybe filesystems parameters).

So, should I add a check to the sd or wd drivers to print a warning (dependant
on a compile-time option) when a disk with write-back cache enabled is probed ?
Or maybe put it in the filesystem layer, at mount time ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 24 ans d'experience feront toujours la difference
--