Re: [PATCH 2/4] brd: Add getgeo to block ops

From: Boaz Harrosh
Date: Thu Aug 07 2014 - 05:20:39 EST


On 08/06/2014 08:52 PM, Ross Zwisler wrote:
> On Wed, 6 Aug 2014, Boaz Harrosh wrote:
>> From: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>
>>
>> Some programs require HDIO_GETGEO work, which requires we implement
>> getgeo. Based off of the work done to the NVMe driver in this commit:
>>
<>
>> +static int brd_getgeo(struct block_device *bd, struct hd_geometry *geo)
>> +{
>> + /* some standard values */
>> + geo->heads = 1 << 6;
>> + geo->sectors = 1 << 5;
>> + geo->cylinders = get_capacity(bd->bd_disk) >> 11;
>> + return 0;
>> +}
>> +
<>
> This looks good.
>

Actually this one is wrong. When I go into fdisk it always gives me
34 as the first possible sector. (And with my 4k patch it gives me
40)

But what I really want is just plain 8. All I want is to waist first
4k for partition table and enough is enough. So actually this above
is wrong.

All we need is :
+ geo->heads = 1 ;
+ geo->sectors = 1 ;
+ geo->cylinders = 1;

Now do not worry the capacity is never extracted from this 32bit structure
for a long time. The capacity is fetched else where, in all programs. This
here just gives you that wired HD math calculation for this 34 sectors
alignment crap.

I just tried it works perfectly with fdisk and gpart. So I'll post a patch.

Thanks
Boaz

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