>>>>> "Dave" == Dave Chinner <david@xxxxxxxxxxxxx> writes:
>> Ok, if we have mismanaged the alignment and aligned to logical, not
>> physical, then I guess there would be an issue... but at that point
>> we've already messed up (though not catastrophically I guess)...
Dave> That's where I'm concerned - if alignment is screwed because the
Dave> FS is 512B sector aligned (because something read the logical
Dave> sector size), then using a 4k sector will result in torn writes
Dave> because every 4k sector write is potentially made up of 2 4k write
Dave> IOs, not 1.
There's another inherent failure scenario with 512b logical / 4096b
physical. If you write in 512-byte multiples and experience a medium
error you can lose the sibling logical blocks within that physical
block. You'll get an I/O error back but there are no means to
communicate that you have also lost blocks that were not part of your
write request. So if you use 512-byte entries in the journal and get a
write error you should at the very minimum consider adjacent entries
inside a 4KB window suspect.
Dave> That's my concern - using the logical 512b sector size is -always-
Dave> safe, but using the 4k physical block size is only safe if
Dave> everything under the filesystem has detected and used the physical
Dave> block size of the disk for alignment and sector sizes...
You should always take alignment into account.
And while Christoph is right that (thankfully) nobody ended up shipping
drives with 1-alignment by default, most 512e drives have the alignment
jumper and some people actually use it.
Martin K. Petersen Oracle Linux Engineering