[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <64f82273-adc6-ce79-5d1f-ae4b54efd240@wdc.com>
Date: Thu, 15 Dec 2016 09:55:36 +0900
From: Damien Le Moal <damien.lemoal@....com>
To: Stefan Haberland <sth@...ux.vnet.ibm.com>, axboe@...nel.dk,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: hoeppner@...ux.vnet.ibm.com, sebott@...ux.vnet.ibm.com
Subject: Re: [RFC] block: check partition alignment
> sd.c ensures that the logical block size (sector size in sd.c) is a
> power of 2 between 512 and 4096. So you can use:
>
> if (p.start & (bdev_physical_block_size(bdev) - 1))
Sorry, that was a little too short as a complete proof:
sd.c ensures that the logical block size (sector size in sd.c) is a
power of 2 between 512 and 4096, and the physical block size is a power
of 2 number of logical blocks. So the physical block size is also always
a power of 2.
>
> Or use div_u64_rem to avoid an error on 32 bits builds.
>
> Best regards.
>
--
Damien Le Moal, Ph.D.
Sr. Manager, System Software Research Group,
Western Digital Corporation
Damien.LeMoal@....com
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.wdc.com, www.hgst.com
Powered by blists - more mailing lists