Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

ATA support for 4k sector size

 

 

First page Previous page 1 2 Next page Last page  View All Linux kernel RSS feed   Index | Next | Previous | View Threaded


matthew at wil

Feb 25, 2009, 2:24 PM

Post #1 of 36 (11775 views)
Permalink
ATA support for 4k sector size

The two patches following this add support for drives which have sector
sizes other than 512 bytes. I haven't been able to test this as I don't
have the hardware.

Individual host drivers will have to be updated to support sizes other
than 512 bytes.

Support for logical sector sizes that differ from physical sector sizes
depends on the READ CAPACITY 16 patch I posted in December that isn't in
scsi-misc yet.

The approach I've taken to generating the tables of which commands need
a 512-byte transfer size and which use the drive's sector size command is
'innovative'. Review is encouraged ;-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hpa at zytor

Feb 25, 2009, 2:53 PM

Post #2 of 36 (11552 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

Matthew Wilcox wrote:
> The two patches following this add support for drives which have sector
> sizes other than 512 bytes. I haven't been able to test this as I don't
> have the hardware.
>
> Individual host drivers will have to be updated to support sizes other
> than 512 bytes.
>
> Support for logical sector sizes that differ from physical sector sizes
> depends on the READ CAPACITY 16 patch I posted in December that isn't in
> scsi-misc yet.
>
> The approach I've taken to generating the tables of which commands need
> a 512-byte transfer size and which use the drive's sector size command is
> 'innovative'. Review is encouraged ;-)

What sector size do we report to user space for this? I'm asking
because logical sector size is visible in most partition formats.

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 3:27 PM

Post #3 of 36 (11523 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "hpa" == H Peter Anvin <hpa [at] zytor> writes:

>> The two patches following this add support for drives which have
>> sector sizes other than 512 bytes. I haven't been able to test this
>> as I don't have the hardware.

hpa> What sector size do we report to user space for this? I'm asking
hpa> because logical sector size is visible in most partition formats.

There are several flavors of drives we have to deal with:

512-byte logical / 512-byte hardware (current)
512-byte logical / 4096-byte hardware (ATA, doing read-modify-write)
4096-byte logical / 4096-byte hardware (SCSI initially, ATA later)

Because of 63-sector legacy problems a bunch of ATA vendors will
initially ship 512/4096 drives that are not naturally aligned.
I.e. logical sector 63 will be aligned on a 4KB hardware sector
boundary to overcome the misaligned default partitioning.

I have been working on some alignment patches the last week. They hook
into the stuff Matthew has been doing in libata and I'll post them
shortly.

For each block device you'll get a hardware sector size exposed as well
as whether the device (partition) is naturally aligned or not. This
works for both ATA and SCSI devices.

I'll defer to people like yourself for how this needs to work wrt. boot
loaders and creating partition tables. I'm CC:ing Eric Sandeen because
he's also looking at this...

--
Martin K. Petersen Oracle Linux Engineering

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hpa at zytor

Feb 25, 2009, 3:33 PM

Post #4 of 36 (11520 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

Martin K. Petersen wrote:
>
> I'll defer to people like yourself for how this needs to work wrt. boot
> loaders and creating partition tables. I'm CC:ing Eric Sandeen because
> he's also looking at this...
>

I wish it was left to people like myself. Realistically when it comes
to disks with 4096-byte logical sectors it going to matter how the
firmware chooses to expose it.

Most likely, the universe will explode at this time, since very few
bootloaders can deal with a sector size other than 512 bytes, and
virtually every partition table format contains a sector size
dependency, which also means you'll break any mechanical imaging solution.

It's going to hurt :(

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hpa at zytor

Feb 25, 2009, 3:42 PM

Post #5 of 36 (11504 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

Martin K. Petersen wrote:
>
> Because of 63-sector legacy problems a bunch of ATA vendors will
> initially ship 512/4096 drives that are not naturally aligned.
> I.e. logical sector 63 will be aligned on a 4KB hardware sector
> boundary to overcome the misaligned default partitioning.
>

I was under the impression Vista didn't do this? Is there any way to
force these drives into a sane mode (at the expense of a total data loss)?

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


david at lang

Feb 25, 2009, 3:49 PM

Post #6 of 36 (11512 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

On Wed, 25 Feb 2009, Martin K. Petersen wrote:

>>>>>> "hpa" == H Peter Anvin <hpa [at] zytor> writes:
>
>>> The two patches following this add support for drives which have
>>> sector sizes other than 512 bytes. I haven't been able to test this
>>> as I don't have the hardware.
>
> hpa> What sector size do we report to user space for this? I'm asking
> hpa> because logical sector size is visible in most partition formats.
>
> There are several flavors of drives we have to deal with:
>
> 512-byte logical / 512-byte hardware (current)
> 512-byte logical / 4096-byte hardware (ATA, doing read-modify-write)
> 4096-byte logical / 4096-byte hardware (SCSI initially, ATA later)

add to this good support for SSDs

?? logical / 128K hardware

or similar.

David Lang

> Because of 63-sector legacy problems a bunch of ATA vendors will
> initially ship 512/4096 drives that are not naturally aligned.
> I.e. logical sector 63 will be aligned on a 4KB hardware sector
> boundary to overcome the misaligned default partitioning.
>
> I have been working on some alignment patches the last week. They hook
> into the stuff Matthew has been doing in libata and I'll post them
> shortly.
>
> For each block device you'll get a hardware sector size exposed as well
> as whether the device (partition) is naturally aligned or not. This
> works for both ATA and SCSI devices.
>
> I'll defer to people like yourself for how this needs to work wrt. boot
> loaders and creating partition tables. I'm CC:ing Eric Sandeen because
> he's also looking at this...
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 3:51 PM

Post #7 of 36 (11512 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "hpa" == H Peter Anvin <hpa [at] zytor> writes:

hpa> I wish it was left to people like myself. Realistically when it
hpa> comes to disks with 4096-byte logical sectors it going to matter
hpa> how the firmware chooses to expose it.

Well. In the short term ATA is going to emulate 512 (at a penalty for
misaligned I/O). SCSI is switching to 4KB wholesale.

I have a 4KB/4KB drive here that I have had fun booting from the last
few days.


hpa> Most likely, the universe will explode at this time, since very few
hpa> bootloaders can deal with a sector size other than 512 bytes, and
hpa> virtually every partition table format contains a sector size
hpa> dependency, which also means you'll break any mechanical imaging
hpa> solution.

hpa> It's going to hurt :(

Yep, it sucks :|

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 3:55 PM

Post #8 of 36 (11521 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "hpa" == H Peter Anvin <hpa [at] zytor> writes:

>> Because of 63-sector legacy problems a bunch of ATA vendors will
>> initially ship 512/4096 drives that are not naturally aligned.
>> I.e. logical sector 63 will be aligned on a 4KB hardware sector
>> boundary to overcome the misaligned default partitioning.
>>

hpa> I was under the impression Vista didn't do this? Is there any way
hpa> to force these drives into a sane mode (at the expense of a total
hpa> data loss)?

Modern Windows aligns the first partition on a 1 MB boundary.

As far as disks go, initially the plan was to have "legacy" branded
drives with 63-sector alignment. But I think that has been abandoned in
favor of instant one-time formatting. I.e. you can pick your poison
*once* and that formatting will be done in constant time. Any
subsequent changes to blocking and alignment will require a real
low-level format.

That's all fine and dandy if you go down and buy a drive a Fry's and
you're the first to use it. But we don't have that luxury on systems
that come preinstalled with Windows. In that case we have to deal with
whatever the OEM decided during manufacturing.

IOW, we have to deal with all the possible configurations.

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hpa at zytor

Feb 25, 2009, 3:57 PM

Post #9 of 36 (11508 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

Martin K. Petersen wrote:
>
> Modern Windows aligns the first partition on a 1 MB boundary.
>
> As far as disks go, initially the plan was to have "legacy" branded
> drives with 63-sector alignment. But I think that has been abandoned in
> favor of instant one-time formatting. I.e. you can pick your poison
> *once* and that formatting will be done in constant time. Any
> subsequent changes to blocking and alignment will require a real
> low-level format.
>

Why one-time?

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 4:04 PM

Post #10 of 36 (11506 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "david" == david <david [at] lang> writes:

>> 512-byte logical / 512-byte hardware (current) 512-byte logical /
>> 4096-byte hardware (ATA, doing read-modify-write) 4096-byte logical /
>> 4096-byte hardware (SCSI initially, ATA later)

david> add to this good support for SSDs

david> ?? logical / 128K hardware

david> or similar.

Yep. And that goes for RAID arrays too.

For SCSI there some knobs we can query to get this information and my
alignment changes are using those (and they are in turn what Willy's
stuff hooks into).

I've been lobbying the SSD vendors whose architecture is prone to
misalignment problems to propose a similar set of knobs for ATA. But so
far it's just been a lot of talking.

My topology changes are a bit abstract in the sense that they expose:

- smallest I/O you can submit without incurring a penalty (hw sector,
raid chunk size)

- optimal I/O size for the device in question

- biggest I/O you can submit without incurring a penalty

- alignment

We can use these parameters to lay out partitions and filesystems
optimally. Just like we currently do with XFS but implemented in a more
generic way that all filesystems can use.

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 4:07 PM

Post #11 of 36 (11503 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "hpa" == H Peter Anvin <hpa [at] zytor> writes:

hpa> Martin K. Petersen wrote:
>>
>> Modern Windows aligns the first partition on a 1 MB boundary.
>>
>> As far as disks go, initially the plan was to have "legacy" branded
>> drives with 63-sector alignment. But I think that has been abandoned
>> in favor of instant one-time formatting. I.e. you can pick your
>> poison *once* and that formatting will be done in constant time. Any
>> subsequent changes to blocking and alignment will require a real
>> low-level format.
>>

hpa> Why one-time?

It's a compromise to avoid hours of low-level formatting before you can
use a drive. New drives will come from the factory formatted in a
special way that can be switched instantaneously. But once you start
writing you're stuck with it.

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hpa at zytor

Feb 25, 2009, 4:10 PM

Post #12 of 36 (11508 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

Martin K. Petersen wrote:
>
> hpa> Why one-time?
>
> It's a compromise to avoid hours of low-level formatting before you can
> use a drive. New drives will come from the factory formatted in a
> special way that can be switched instantaneously. But once you start
> writing you're stuck with it.
>

That's ridiculously stupid. All you need is an offset parameter, which
can be flipped at will. Now, flipping it will obviously scramble all
data, but there is absolutely no reason why it shouldn't be possible to
instantaneously flip it back and forth.

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


david at lang

Feb 25, 2009, 4:13 PM

Post #13 of 36 (11507 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

On Wed, 25 Feb 2009, Martin K. Petersen wrote:

>>>>>> "david" == david <david [at] lang> writes:
>
>>> 512-byte logical / 512-byte hardware (current) 512-byte logical /
>>> 4096-byte hardware (ATA, doing read-modify-write) 4096-byte logical /
>>> 4096-byte hardware (SCSI initially, ATA later)
>
> david> add to this good support for SSDs
>
> david> ?? logical / 128K hardware
>
> david> or similar.
>
> Yep. And that goes for RAID arrays too.
>
> For SCSI there some knobs we can query to get this information and my
> alignment changes are using those (and they are in turn what Willy's
> stuff hooks into).
>
> I've been lobbying the SSD vendors whose architecture is prone to
> misalignment problems to propose a similar set of knobs for ATA. But so
> far it's just been a lot of talking.

even if we can't get them to give us any info from the drive directly, we
still want to allow the sysadmin to configure the use of the systems when
they can find the info in other ways.

> My topology changes are a bit abstract in the sense that they expose:
>
> - smallest I/O you can submit without incurring a penalty (hw sector,
> raid chunk size)
>
> - optimal I/O size for the device in question
>
> - biggest I/O you can submit without incurring a penalty
>
> - alignment
>
> We can use these parameters to lay out partitions and filesystems
> optimally. Just like we currently do with XFS but implemented in a more
> generic way that all filesystems can use.

if you have the smallest and largest I/O you can submit without a penalty
and the alignment, isn't the optimal I/O size everything between these
two? (or at least everything between these two may be close enough that
defining an 'optimal' size may not be worthwhile)

David Lang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 4:17 PM

Post #14 of 36 (11503 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "hpa" == H Peter Anvin <hpa [at] zytor> writes:

hpa> That's ridiculously stupid. All you need is an offset parameter,
hpa> which can be flipped at will. Now, flipping it will obviously
hpa> scramble all data, but there is absolutely no reason why it
hpa> shouldn't be possible to instantaneously flip it back and forth.

I'm just quoting what I was told a few months ago. I'm not
participating in IDEMA and for all I know that approach could have
changed again.

I'll ask one of my contacts to find out what the current status is...

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 4:20 PM

Post #15 of 36 (11493 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "david" == david <david [at] lang> writes:

david> even if we can't get them to give us any info from the drive
david> directly, we still want to allow the sysadmin to configure the
david> use of the systems when they can find the info in other ways.

You can specify RAID parameters on the mkfs.xfs command line today.
mke[234]fs have similar knobs.


david> if you have the smallest and largest I/O you can submit without a
david> penalty and the alignment, isn't the optimal I/O size everything
david> between these two? (or at least everything between these two may
david> be close enough that defining an 'optimal' size may not be
david> worthwhile)

These parameters come straight out of SCSI. I described them wrong.
maximum is the biggest I/O the device can handle, full stop. Optimal is
the preferred I/O size for the array.

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


tytso at mit

Feb 25, 2009, 6:50 PM

Post #16 of 36 (11486 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

On Wed, Feb 25, 2009 at 06:27:18PM -0500, Martin K. Petersen wrote:
>
> Because of 63-sector legacy problems a bunch of ATA vendors will
> initially ship 512/4096 drives that are not naturally aligned.
> I.e. logical sector 63 will be aligned on a 4KB hardware sector
> boundary to overcome the misaligned default partitioning.
>

Are we *sure* that this is what they plan to be doing? Is there a way
we can query the hardware to find out for sure what drives are doing
what?

I'll note that Vista starts all new partitions at the 1MB boundary, so
its filesystems will be naturally aligned. As I mentioned in a recent blog
entry:

http://thunk.org/tytso/blog/2009/02/20/aligning-filesystems-to-an-ssds-erase-block-size/

... this is one place Vista is ahead of Linux. So while Microsoft's
market share has slipped, 85% of all new x86 machines still have some
variant of Redmond-spawn installed on them, and with the advent of
Windows 7 coming soon, and Microsoft making it harder and harder for
vendors to ship machines upgraded to Windows XP, it
seems... surprising... that new disks meant for Windows Vista or
Windows 7 systems would be misaligned to start at logical sector 63.

- Ted

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 7:05 PM

Post #17 of 36 (11488 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "Ted" == Theodore Tso <tytso [at] mit> writes:

>> Because of 63-sector legacy problems a bunch of ATA vendors will
>> initially ship 512/4096 drives that are not naturally aligned.
>> I.e. logical sector 63 will be aligned on a 4KB hardware sector
>> boundary to overcome the misaligned default partitioning.
>>

Ted> Are we *sure* that this is what they plan to be doing?

I have asked my contacts to verify. That was the plan as of last
October.


Ted> Is there a way we can query the hardware to find out for sure what
Ted> drives are doing what?

Yep. And with my patches the appropriate alignment is exposed in sysfs
for each block device.

Hardware workarounds for DOS partition table brain damage have existed
for a long time. On a lot of RAID arrays you have to pick a LUN
personality. And by choosing DOS/Windows/Linux you often align sector
63 to the internal RAID chunk size.

I'm working with several RAID vendors to make sure they set the right
alignment offset when they do that. That isn't currently the case. The
alignment knobs only recently made their appearance in the spec to
accommodate the 4KB sector transition.


Ted> I'll note that Vista starts all new partitions at the 1MB boundary,
Ted> so its filesystems will be naturally aligned.

Maybe. See above.

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


matthew at wil

Feb 25, 2009, 7:07 PM

Post #18 of 36 (11491 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

On Wed, Feb 25, 2009 at 09:50:43PM -0500, Theodore Tso wrote:
> On Wed, Feb 25, 2009 at 06:27:18PM -0500, Martin K. Petersen wrote:
> > Because of 63-sector legacy problems a bunch of ATA vendors will
> > initially ship 512/4096 drives that are not naturally aligned.
> > I.e. logical sector 63 will be aligned on a 4KB hardware sector
> > boundary to overcome the misaligned default partitioning.
>
> Are we *sure* that this is what they plan to be doing? Is there a way
> we can query the hardware to find out for sure what drives are doing
> what?

The drive I have that's pretending to be a 512/4k drive reports this:

$ sudo sg_readcap -l /dev/sdc
Read Capacity results:
Protection: prot_en=0, p_type=0
Last logical block address=625142447 (0x2542eaaf), Number of logical blocks=625142448
Logical block length=512 bytes
Logical blocks per physical block=3 (log base 2) [actual=8]
Lowest aligned logical block address=0
Hence:
Device size: 320072933376 bytes, 305245.3 MiB, 320.07 GB

This disagrees with Martin's assertion.

--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 7:23 PM

Post #19 of 36 (11481 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "Matthew" == Matthew Wilcox <matthew [at] wil> writes:

Matthew> Lowest aligned logical block address=0

Matthew> This disagrees with Martin's assertion.

The original roadmap was to transition to 4KB sectors in 2006,
coinciding with the Vista release.

Given how long this has taken (we're now talking ~2011 for GA) it may
very well be that the alignment knobs will be unused because everybody
will be using Vista or 7 by then.

That doesn't change the RAID array alignment problem, however. And we
need to prepare our partitioning tools to align correctly regardless.

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 25, 2009, 9:16 PM

Post #20 of 36 (11476 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "Matthew" == Matthew Wilcox <matthew [at] wil> writes:

Matthew> Lowest aligned logical block address=0

Matthew> This disagrees with Martin's assertion.

Quick answer from one of my contacts. Desktop drives will indeed ship
with an alignment of 1(*). The alignment is hardwired at time of
manufacture and can't be changed.

(*) I had to go back and reread the ATA spec to grok this. READ
CAPACITY(16) indicates the lowest naturally aligned LBA. With LBA 63
offset in play that would be LBA 7.

ATA, on the other hand, indicates how much LBA 0 is offset from the
beginning of the first physical sector. If LBA 63 is naturally aligned
that means that LBA 0 is offset 512 bytes (physical sector 0 starts at
LBA -1 if you will). Hence IDENTIFY DEVICE word 209 will contain 0x4001.

So you need to tweak your RC16 response a bit...

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


matthew at wil

Feb 26, 2009, 4:36 AM

Post #21 of 36 (11469 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

On Thu, Feb 26, 2009 at 12:16:00AM -0500, Martin K. Petersen wrote:
> >>>>> "Matthew" == Matthew Wilcox <matthew [at] wil> writes:
>
> Matthew> Lowest aligned logical block address=0
>
> Matthew> This disagrees with Martin's assertion.
>
> Quick answer from one of my contacts. Desktop drives will indeed ship
> with an alignment of 1(*). The alignment is hardwired at time of
> manufacture and can't be changed.

Hm. I'll have to poke my contacts about this drive they've given me then.
I just checked (with hdparm --Istdout) and word 209 is 0x4000 with
this drive.

> (*) I had to go back and reread the ATA spec to grok this. READ
> CAPACITY(16) indicates the lowest naturally aligned LBA. With LBA 63
> offset in play that would be LBA 7.
>
> ATA, on the other hand, indicates how much LBA 0 is offset from the
> beginning of the first physical sector. If LBA 63 is naturally aligned
> that means that LBA 0 is offset 512 bytes (physical sector 0 starts at
> LBA -1 if you will). Hence IDENTIFY DEVICE word 209 will contain 0x4001.
>
> So you need to tweak your RC16 response a bit...

You're right. I think I want something like:

((1 << log_per_phys) - first_sector_offset) % (1 << log_per_phys);

If you have 8 logical sectors per physical, and ATA reports 0x4001, SCSI
wants to hear 7. The only corner case is ATA reporting 0x4000 and SCSI
wanting to hear 0, not 8, hence the % (1 << log_per_phys).

--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


kzak at redhat

Feb 26, 2009, 4:43 AM

Post #22 of 36 (11479 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

On Wed, Feb 25, 2009 at 03:33:46PM -0800, H. Peter Anvin wrote:
> virtually every partition table format contains a sector size
> dependency

Is it true that "every partition table format"? I see in
fs/partitions/ that only ibm.c and msdos.c care about a sector size.
It seems that the others formats are based on 512 sectors only.

Karel

--
Karel Zak <kzak [at] redhat>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hpa at zytor

Feb 26, 2009, 7:17 AM

Post #23 of 36 (11475 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

Karel Zak wrote:
> On Wed, Feb 25, 2009 at 03:33:46PM -0800, H. Peter Anvin wrote:
>> virtually every partition table format contains a sector size
>> dependency
>
> Is it true that "every partition table format"? I see in
> fs/partitions/ that only ibm.c and msdos.c care about a sector size.
> It seems that the others formats are based on 512 sectors only.
>

And do they do so correctly?

Looking at the UEFI spec for one, the GPT partition table format
definitely has a logical sector size dependency.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hpa at zytor

Feb 26, 2009, 7:32 AM

Post #24 of 36 (11462 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

Martin K. Petersen wrote:
>
> Quick answer from one of my contacts. Desktop drives will indeed ship
> with an alignment of 1(*). The alignment is hardwired at time of
> manufacture and can't be changed.
>

Oh God.

This is a disaster.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


martin.petersen at oracle

Feb 26, 2009, 12:35 PM

Post #25 of 36 (11439 views)
Permalink
Re: ATA support for 4k sector size [In reply to]

>>>>> "hpa" == H Peter Anvin <hpa [at] zytor> writes:

>> Quick answer from one of my contacts. Desktop drives will indeed
>> ship with an alignment of 1(*). The alignment is hardwired at time
>> of manufacture and can't be changed.
>>

hpa> Oh God.

hpa> This is a disaster.

Rationale being that modern Microsoft operating systems know how to
interpret the alignment bits. Legacy XP will work without changes
thanks to the shifted alignment. And Vista+ will do the right thing to
align partition 1 to what the drive reports.

Also note that Windows only aligns the first partition. That's
something we need to be aware of when setting up dual boot systems.

--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

First page Previous page 1 2 Next page Last page  View All Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.