Subject: Re: disk caching
To: Dieter <>
From: Chuck Swiger <>
List: netbsd-users
Date: 02/05/2006 11:17:19
Dieter wrote:
>>>> This makes predictable and reliable crash recovery of on-disk data structures
>>>> (filesystems, databases etc.) impossible.
>>> I was under the impression that filesystems had the ability to force
>>> the order of writes when they needed to?  Am I misremembering?
>> The filesystem can attempt to enforce write order.
> The quote from FreeBSD makes it sound like the filesystem cannot
> enforce write order, unless one gets rid of block devices.
> This just doesn't sound right.

Which quote are you talking about?

The article I linked to discusses why FreeBSD doesn't have block devices
anymore, but that's not related, at least not directly, to the issue of the
filesystem enforcing write order.

Softupdates would really like write order to be enforced properly.

>>> Is this a problem in NetBSD?
>> It's an issue which affects all operating systems.
> I'm assuming that by "issue" you are referring to the drive lying about
> a write being complete?


> By "problem", I meant, can the NetBSD filesystem code enforce write order?
> (assuming that the disk is not lying about writes being complete)

Sure, or at least I'd imagine so.  I'm sure the local equivalent to Scott Long
could tell you better than I how NetBSD handles tagged command queuing for SCSI

>> Unfortunately, most IDE drives will reorder writes internally and will lie about
>> whether they have actually completed transactions.  This is true for many drives
>> even if you tell the drive not to enable the write cache.
> Are you saying some drives totally ignore the "turn the write cache off"
> command?  This is easy to test for.  I see a 10x difference in write
> performance between the write cache being on or off.  Or is there some
> other problem?

I'm saying some drives ignore the ATA "FLUSH CACHE" command, so you can't
enforce filesystem write barriers, or whatever you want to call it.

Google for "FreeBSD write barrier Matthias Buelow" and you can read a buncha
threads about "write barriers", "dangerous situation with shutdown", etc etc.