[Top] [All Lists]

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

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH] libxfs: Get Physical Sector Size instead of Logical Sector size
From: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>
Date: Mon, 28 Nov 2011 11:08:29 -0500
Cc: Eric Sandeen <sandeen@xxxxxxxxxxx>, Carlos Maiolino <cmaiolino@xxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <20111127235051.GX2386@dastard> (Dave Chinner's message of "Mon, 28 Nov 2011 10:50:51 +1100")
Organization: Oracle
References: <1322162451-17036-1-git-send-email-cmaiolino@xxxxxxxxxx> <20111124195042.GA3671@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20111127010643.GU2386@dastard> <4ED2C233.8010104@xxxxxxxxxxx> <20111127235051.GX2386@dastard>
User-agent: Gnus/5.110017 (No Gnus v0.17) Emacs/23.2 (gnu/linux)
>>>>> "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

<Prev in Thread] Current Thread [Next in Thread>