From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boaz Harrosh Subject: [RFC 4/9] SQUASHME: prd: Fixs to getgeo Date: Wed, 13 Aug 2014 15:14:03 +0300 Message-ID: <53EB568B.2060006@plexistor.com> References: <53EB5536.8020702@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit To: Ross Zwisler , linux-fsdevel , Andrew Morton , linux-mm@kvack.org, Matthew Wilcox , Sagi Manole , Yigal Korman Return-path: In-Reply-To: <53EB5536.8020702@gmail.com> Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org From: Boaz Harrosh With current values fdisk does the wrong thing. Setting all values to 1, will make everything nice and easy. Note that current code had a BUG with anything bigger than 64G because hd_geometry->cylinders is ushort and it would overflow at this value. Any way capacity is not calculated through getgeo so it does not matter what you put here. Signed-off-by: Boaz Harrosh --- drivers/block/prd.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/block/prd.c b/drivers/block/prd.c index cc0aabf..62af81e 100644 --- a/drivers/block/prd.c +++ b/drivers/block/prd.c @@ -55,10 +55,18 @@ struct prd_device { static int prd_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; + /* Just tell fdisk to get out of the way. The math here is so + * convoluted and does not make any sense at all. With all 1s + * The math just gets out of the way. + * NOTE: I was trying to get some values that will make fdisk + * Want to align first sector on 4K (like 8, 16, 20, ... sectors) but + * nothing worked, I searched the net the math is not your regular + * simple multiplication at all. If you managed to get these please + * fix here. For now we use 4k physical sectors for this + */ + geo->heads = 1; + geo->sectors = 1; + geo->cylinders = 1; return 0; } -- 1.9.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org