From owner-freebsd-fs Thu Sep 21 12: 2:31 2000 Delivered-To: freebsd-fs@freebsd.org Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by hub.freebsd.org (Postfix) with ESMTP id 1483537B43C for ; Thu, 21 Sep 2000 12:02:29 -0700 (PDT) Received: (from smap@localhost) by whistle.com (8.10.0/8.10.0) id e8LJ10f13054; Thu, 21 Sep 2000 12:01:00 -0700 (PDT) Received: from bubba.whistle.com( 207.76.205.7) by whistle.com via smap (V2.0) id xma013052; Thu, 21 Sep 2000 12:00:32 -0700 Received: (from archie@localhost) by bubba.whistle.com (8.9.3/8.9.3) id MAA18117; Thu, 21 Sep 2000 12:00:32 -0700 (PDT) (envelope-from archie) From: Archie Cobbs Message-Id: <200009211900.MAA18117@bubba.whistle.com> Subject: Re: disable write caching with softupdates? In-Reply-To: <200009211820.UAA40830@freebsd.dk> "from Soren Schmidt at Sep 21, 2000 08:20:07 pm" To: Soren Schmidt Date: Thu, 21 Sep 2000 12:00:32 -0700 (PDT) Cc: mbendiks@eunet.no, terry@lambert.org, fs@freebsd.org X-Mailer: ELM [version 2.4ME+ PL82 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Soren Schmidt writes: > > Thanks.. I was talking about a sysctl patch, where you could > > turn write caching on or off at any time while the system is > > running via sysctl. Is it even possible to do that? > > Why on earth would you want this as a sysctl knob ? > Either you want to play it safe, or you dont care, this is not > something you change your mind about now and then.... OK, here's an example. You have an /etc/rc script that checks at startup what kind of disk you have (eg "dmesg | grep -q QUANTUM") and for certain disk types that are known to lie about their write guarantees enables or disables write caching as appropriate. FYI I can confirm what Terry said that few disks we've encountered guarantee atomic sector writes in the face of power failure (i.e., leading to a corrupted/lost sector), much less flushing the entire write cache, so IMHO the answer to.. > I'm planning to make it a compile time option, the question > is what the default should be... ..is clearly "disabled" -- and then "enable at your own risk if you know that your disk doesn't lie (or don't care)". > The _right_ solution of cause is to have the FS code pass down > a flag that says only write this when all preceeding bufs are > on the media, now _that_ would be nice and work for both ATA > and SCSI devices.... Agreed, this is the best solution. I think it is necessary in order to make the promise of softupdates really rigorous. What we do on the InterJet right now is detect a power failure and, if detected, freeze the system immediately. This guarantees that the disk won't write a corrupted sector (because our power supply has 80ms or so of residual power -- enough for the disk to finish writing). Disabling write caching guarantees that the sectors believed to be written by soft-updates actually are when the system freezes. BOTH guarantees are necessary in order to guarantee a valid disk. -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message