Re: [PATCH] libxfs: Get Physical Sector Size instead of Logical Sector size

Christoph Hellwig
2011-11-28T07:56:49Z

On Mon, Nov 28, 2011 at 10:50:51AM +1100, Dave Chinner wrote:
> > I had the expectation that physical block size WAS the fundamental/atomic
> > IO size for the disk, and anything smaller required read/modify/write.
> > So I made this suggestion (and I think hch concurred) so that we weren't
> > doing log IOs which required RMW & translation.
>
> A RMW cycle does not mean the IO is not atomic. The write to disk
> will still be atomic, regardless of the read that ovvurred before.

I would not trust ATA disk to get this right generally.

> > 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)...
>
> That's where I'm concerned - if alignment is screwed because the FS
> is 512B sector aligned (because something read the logical sector size),
> then using a 4k sector will result in torn writes because every 4k
> sector write is potentially made up of 2 4k write IOs, not 1.

Disks that implement the ATA level required to tell us about the
physical blocksize also have the alignment offset information in the
IDENTIFY data to tell us about aligned shifts. But I haven't seen a
single one with a non-zero aligned offset in the wild.