On Tue, Dec 04, 2012 at 09:26:17AM -0500, Thor Lancelot Simon wrote: > > > And, can't you do that with traditional drives, drives which really do > > > have 512-byte sectors? Do a 4K transfer and you write 8 physical > > > sectors with no opportunity for any other operation to see the write > > > partially done. Is that wrong, or am I missing something else? > > > > Insert a kernel panic (or power failure(*)) after five sectors and > > What's a kernel panic got to do with it? If you hand the controller > and thus the drive 4K write, the kernel panicing won't suddenly cause > you to reverse time and have issued 8 512-byte writes instead.
That depends on additional properties of the pathway from the FS to the drive firmware. It might have sent 1 of 2 2048-byte writes before the panic, for example. Or it might be a vintage controller incapable of handling more than one sector at a time. Also, if there's a panic while the kernel is in the middle of talking to the drive, such that the drive receives only part of the data you intended to send, one can be reasonably certain it will reject a partial sector... but if it's received 5 of 8 physical sectors and the 6th is partial, it may well write out those 5, which isn't what was intended. > Given how drives actually write data, I would not be so sanguine > that any sector, of whatever size, in-flight when the power fails, > is actually written with the values you expect, or not written > at all. Yes, I'm aware of that. It remains a useful approximation, especially for already-existing FS code. -- David A. Holland dholl...@netbsd.org