[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <afefbd10-e680-47c3-bd18-b3f2aae35a15@kernel.org>
Date: Fri, 5 Jul 2024 10:08:32 +0900
From: Damien Le Moal <dlemoal@...nel.org>
To: Mikulas Patocka <mpatocka@...hat.com>, Li Dong <lidong@...o.com>
Cc: Alasdair Kergon <agk@...hat.com>, Mike Snitzer <snitzer@...nel.org>,
"open list:DEVICE-MAPPER (LVM)" <dm-devel@...ts.linux.dev>,
open list <linux-kernel@...r.kernel.org>, opensource.kernel@...o.com
Subject: Re: [PATCH] dm-table:fix zone block_device not aligned with zonesize
On 7/5/24 00:29, Mikulas Patocka wrote:
>
>
> On Thu, 4 Jul 2024, Li Dong wrote:
>
>> For zone block devices, device_area_is_invalid may return an incorrect
>> value.
>>
>> Failure log:
>> [ 19.337657]: device-mapper: table: 254:56: len=836960256 not aligned to
>> h/w zone size 3244032 of sde
>> [ 19.337665]: device-mapper: core: Cannot calculate initial queue limits
>> [ 19.337667]: device-mapper: ioctl: unable to set up device queue for
>> new table.
>>
>> Actually, the device's zone length is aligned to the zonesize.
>>
>> Fixes: 5dea271b6d87 ("dm table: pass correct dev area size to device_area_is_valid")
>> Signed-off-by: Li Dong <lidong@...o.com>
>> ---
>> drivers/md/dm-table.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
>> index 33b7a1844ed4..0bddae0bee3c 100644
>> --- a/drivers/md/dm-table.c
>> +++ b/drivers/md/dm-table.c
>> @@ -257,7 +257,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
>> if (bdev_is_zoned(bdev)) {
>> unsigned int zone_sectors = bdev_zone_sectors(bdev);
>>
>> - if (start & (zone_sectors - 1)) {
>> + if (start % zone_sectors) {
>> DMERR("%s: start=%llu not aligned to h/w zone size %u of %pg",
>> dm_device_name(ti->table->md),
>> (unsigned long long)start,
>> @@ -274,7 +274,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
>> * devices do not end up with a smaller zone in the middle of
>> * the sector range.
>> */
>> - if (len & (zone_sectors - 1)) {
>> + if (len % zone_sectors) {
>> DMERR("%s: len=%llu not aligned to h/w zone size %u of %pg",
>> dm_device_name(ti->table->md),
>> (unsigned long long)len,
>> --
>> 2.31.1.windows.1
>
> Hi
>
> This probably won't compile on 32-bit architectures because the operators
> for 64-bit divide and modulo don't work there.
>
> Please, rework the patch using dm_sector_div64.
This patch alone will not allow non power of 2 zone size drives to be supported
as the block layer will reject such drive in the first place. This patch should
be part of a larger series enabling such support. On its own, it is a NACK from
me for this change.
--
Damien Le Moal
Western Digital Research
Powered by blists - more mailing lists