Re: [PATCH 4/5] brd: Request from fdisk 4k alignment

From: Boaz Harrosh
Date: Wed Nov 05 2014 - 09:49:04 EST


On 11/05/2014 04:20 PM, Martin K. Petersen wrote:
>>>>>> "Boaz" == Boaz Harrosh <boaz@xxxxxxxxxxxxx> writes:
>
> Hey Boaz,
>
> Boaz> Note that blk_queue_physical_block_size() also trashes io_min, but
> Boaz> we can leave this one to be 512. io_min as opposed to
> Boaz> physical_block_size will actually change Kernel behavior
>
> Care to elaborate?
>
> Boaz> before this patch running fdisk on a default size brd of 4M
> Boaz> the first sector offered is 34 (BAD), but after this patch it
> Boaz> will be 40, ie 8 sectors aligned. Also when entering some random
> Boaz> partition sizes the next partition-start sector is offered 8 sectors
> Boaz> aligned after this patch. (Please note that with fdisk the user
> Boaz> can still enter bad values, only the offered default values will
> Boaz> be correct)

I did elaborate, Please try with these numbers above and see for
yourself. (Summery brd-size=4M before this patch will offer 34 as
first-sector, after 40)

> Also, fdisk and parted should be aligning on 1MB by default regardless
> of block size. So I'm also not sure why you need to trick fdisk to align
> by setting the pbs.
>

fdisk will not align partition-start on 1M, only the very first-sector,
libgparted and cfdisk are as you say, but with fdisk if you put any odd
numbered partition-size, the next start-sector will just be the sum, but
with this patch it will offer a small hole and will align the
partition-start on 4K.
(And even with this patch user can enter bad values)

Please believe me that I did not try to invent work for myself. I wanted
to fix the partition bugs, with the use of direct_access and to my dismay
I found that it is very easy to have broken partition alignments. With this
patch it is still possible but mach harder to do so.

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/