[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e42a0579-61b2-7b77-08cb-6723278490cc@samsung.com>
Date: Wed, 14 Sep 2022 21:16:30 +0200
From: Pankaj Raghav <p.raghav@...sung.com>
To: Mike Snitzer <snitzer@...hat.com>
CC: <hch@....de>, <agk@...hat.com>, <damien.lemoal@...nsource.wdc.com>,
<axboe@...nel.dk>, <snitzer@...nel.org>,
<linux-kernel@...r.kernel.org>, <Johannes.Thumshirn@....com>,
<linux-nvme@...ts.infradead.org>, <pankydev8@...il.com>,
<matias.bjorling@....com>, <linux-block@...r.kernel.org>,
<bvanassche@....org>, <gost.dev@...sung.com>,
<dm-devel@...hat.com>, <hare@...e.de>, <jaegeuk@...nel.org>,
Damien Le Moal <damien.lemoal@....com>
Subject: Re: [PATCH v13 13/13] dm: add power-of-2 target for zoned devices
with non power-of-2 zone sizes
>> +
>> + if (is_power_of_2(zone_size))
>> + DMWARN("%pg: underlying device has a power-of-2 number of sectors per zone",
>> + dmh->dev->bdev);
>> +
>> + dmh->zone_size = zone_size;
>> + dmh->zone_size_po2 = 1 << get_count_order_long(zone_size);
>> + dmh->zone_size_po2_shift = ilog2(dmh->zone_size_po2);
>> + dmh->zone_size_diff = dmh->zone_size_po2 - dmh->zone_size;
>> + ti->private = dmh;
>> + ti->max_io_len = dmh->zone_size_po2;
>> + dmh->nr_zones = npo2_zone_no(dmh, ti->len);
>> + ti->len = dmh->zone_size_po2 * dmh->nr_zones;
>> +
>> + return 0;
>> +}
>
> The above error paths need to unwind the references or any other
> resources acquired before failing. Please see other targets for how
> they handle sequencing of the needed operations (e.g. dm_put_device)
> in the error path by using gotos, etc.
>
Ok. That makes sense, and it should be pretty straight forward to do that.
>> +
>> +static void dm_po2z_io_hints(struct dm_target *ti, struct queue_limits *limits)
>> +{
>> + struct dm_po2z_target *dmh = ti->private;
>> +
>> + limits->chunk_sectors = dmh->zone_size_po2;
>> +}
>
> Are you certain you shouldn't at least be exposing a different
> logical_block_size to upper layers?
>
To be honest, I tested my patches in QEMU with 4k Logical block size and on
a device with 4k LBA size.
I did a quick test with 512B LBA size in QEMU, and I didn't see any
failures when I ran my normal test suite.
Do you see any problem with exposing the same LBA as the underlying device?
>> +
>> +static void dm_po2z_status(struct dm_target *ti, status_type_t type,
>> + unsigned int status_flags, char *result,
>> + unsigned int maxlen)
>> +{
>> + struct dm_po2z_target *dmh = ti->private;
>> + size_t sz = 0;
>> +
>> + switch (type) {
>> + case STATUSTYPE_INFO:
>> + DMEMIT("%s %lld", dmh->dev->name,
>> + (unsigned long long)dmh->zone_size_po2);
>> + break;
>
> Wouldn't it be worthwhile to expose the zone sectors (native npo2 vs
> simulated po2?) You merely roundup but never expose what you're using
> (unless I'm missing something about generic "zoned" device
> capabilities).
>
BLKREPORTZONE ioctl is typically used to get the zone information from a
zoned block device, which should expose the npo2 zone sectors(zone
capacity) in this case.
But I do see the value of exposing the dmh->zone_size instead of
dmh->zone_size_po2 as the latter can be easily calculated from the former
or it can be retrieved by reading the chunk_sectors. I will fix that up.
> Mike
>
Powered by blists - more mailing lists