2010-08-17 17:57:06

by Grant Grundler

[permalink] [raw]
Subject: [PATCH] V2 2.6.35 libata support for > 512 byte sectors (e.g. 4K Native)

Attached patch enables my x86 machine to recognize and talk to a
"Native 4K" SATA device.

When I started working on this, I didn't know Matthew Wilcox had
posted a similar patch 2 years ago:
http://git.kernel.org/?p=linux/kernel/git/willy/ata.git;a=shortlog;h=refs/heads/ata-large-sectors

Gwendal Grignou pointed me at the the above code and small portions of
this patch include Matthew's work. That's why Mathew is first on the
"Signed-off-by:". I've NOT included his use of a bitmap to determine
512 vs Native for ATA command block size - just used a simple table.
And bugs are almost certainly mine.

Lastly, the patch has been tested with a native 4K 'Engineering
Sample' drive provided by Hitachi GST.

Signed-off-by: Matthew Wilcox <[email protected]>
Signed-off-by: Grant Grundler <[email protected]>
Reviewed-by: Gwendal Grignou <[email protected]>

----

V1: Gwendal reviewed had concerns about dev->sdev->sector_size which
seems to be ok.

V2: Matthew Wilcox suggested:
o remove comment about Big Endian (already handled)
o use "scmd->device->sector_size" instead of "dev->sdev->sector_size"
o ata_cmd_ioctl() does PIO data IN and thus should use native size.
o add "safe for large sectors" flag in the case that a
controller can't tolerate >512byte sector commands.

I did NOT add such a flag since I think the right answer would
be "Don't attach a Native 4K block device to that controller" - it
just won't work.

Tejun Heo (and I) prefer to leave ata_cmd_ioctl() hard coded to
512 byte since this ioctl is "should probably be deprecated one day".

thanks,
grant

[ patch NOT inlined because gmail will word-wrap and make a mess of
it. Please use attached file.]


Attachments:
2.6.35-libata_4k_block_support-02 (8.30 kB)

2010-08-18 15:05:28

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] V2 2.6.35 libata support for > 512 byte sectors (e.g. 4K Native)

On Tuesday 17 August 2010, Grant Grundler wrote:
> [ patch NOT inlined because gmail will word-wrap and make a mess of
> it. Please use attached file.]

You should be able to use git-send-email with a gmail account to fix this.

Arnd

2010-08-18 15:30:27

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] V2 2.6.35 libata support for > 512 byte sectors (e.g. 4K Native)

On Wed, Aug 18, 2010 at 05:04:51PM +0200, Arnd Bergmann wrote:
> On Tuesday 17 August 2010, Grant Grundler wrote:
> > [ patch NOT inlined because gmail will word-wrap and make a mess of
> > it. Please use attached file.]
>
> You should be able to use git-send-email with a gmail account to fix this.

Or find an google insider that could fix gmail..

2010-08-18 16:37:00

by Grant Grundler

[permalink] [raw]
Subject: Re: [PATCH] V2 2.6.35 libata support for > 512 byte sectors (e.g. 4K Native)

On Wed, Aug 18, 2010 at 8:30 AM, Christoph Hellwig <[email protected]> wrote:
> On Wed, Aug 18, 2010 at 05:04:51PM +0200, Arnd Bergmann wrote:
>> On Tuesday 17 August 2010, Grant Grundler wrote:
>> > [ patch NOT inlined because gmail will word-wrap and make a mess of
>> > it. Please use attached file.]
>>
>> You should be able to use git-send-email with a gmail account to fix this.

I'll try git-send-email next time - thanks Arndt.

> Or find an google insider that could fix gmail..

You have no idea how many people have already tried this. Just feels
like another windmill at this point. :)

thanks,
grant


>
>