From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boaz Harrosh Subject: Re: [PATCH 4/5] brd: Request from fdisk 4k alignment Date: Wed, 05 Nov 2014 16:43:41 +0200 Message-ID: <545A379D.30608@plexistor.com> References: <545A2D69.8090003@plexistor.com> <545A2F52.3040303@plexistor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Jens Axboe , Matthew Wilcox , Dmitry Monakhov , linux-kernel , linux-fsdevel To: "Martin K. Petersen" , Boaz Harrosh Return-path: Received: from mail-wg0-f46.google.com ([74.125.82.46]:56180 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755017AbaKEOnp (ORCPT ); Wed, 5 Nov 2014 09:43:45 -0500 Received: by mail-wg0-f46.google.com with SMTP id x13so1081441wgg.33 for ; Wed, 05 Nov 2014 06:43:44 -0800 (PST) In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 11/05/2014 04:20 PM, Martin K. Petersen wrote: >>>>>> "Boaz" == Boaz Harrosh 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