[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4cf6348-dd94-aa82-7519-318248c51151@opensource.wdc.com>
Date: Fri, 17 Jun 2022 15:56:03 +0900
From: Damien Le Moal <damien.lemoal@...nsource.wdc.com>
To: Pankaj Raghav <p.raghav@...sung.com>, hch@....de,
snitzer@...hat.com, axboe@...nel.dk
Cc: bvanassche@....org, linux-kernel@...r.kernel.org,
jiangbo.365@...edance.com, hare@...e.de, pankydev8@...il.com,
dm-devel@...hat.com, jonathan.derrick@...ux.dev,
gost.dev@...sung.com, dsterba@...e.com, jaegeuk@...nel.org,
linux-nvme@...ts.infradead.org, Johannes.Thumshirn@....com,
linux-block@...r.kernel.org
Subject: Re: [PATCH v7 13/13] dm: add non power of 2 zoned target
On 6/17/22 15:40, Pankaj Raghav wrote:
> On 2022-06-17 08:12, Damien Le Moal wrote:
>>> I think this is a cleaner approach using features flag and io_hints
>>> instead of messing with the revalidate zone function:
>>>
>>> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
>>> index 135c0cc190fb..c97a71e0473f 100644
>>> --- a/drivers/md/dm-table.c
>>> +++ b/drivers/md/dm-table.c
>>> @@ -1618,6 +1618,9 @@ static int device_not_matches_zone_sectors(struct
>>> dm_target *ti, struct dm_dev *
>>> if (!blk_queue_is_zoned(q))
>>> return 0;
>>>
>>> + if(dm_target_supports_emulated_zone_size(ti->type))
>>> + return 0;
>>> +
>>
>> This should be in validate_hardware_zoned_model(), not here.
>>
> I am not sure about this comment. We need to peek into the individual
> target from the table to check for this feature right?
>
> if (dm_table_any_dev_attr(table, device_not_matches_zone_sectors,
> &zone_sectors)) {
> DMERR("%s: zone sectors is not consistent across all zoned devices",
> dm_device_name(table->md));
> return -EINVAL;
> }
>
> So we call this function device_not_matches_zone_sectors() from
> validate_hardware_zoned_model() for each target and we let the validate
> succeed even if the target's zone size is different from the underlying
> device zone size if this feature flag is set. Let me know if I am
> missing something and how this can be moved to
> validate_hardware_zoned_model().
Your change does not match the function name
device_not_matches_zone_sectors(), at all. So I think this is wrong.
The fact is that zone support in DM has been built under the following
assumptions:
1) A zoned device can be used to create a *zoned* target (e.g. dm-linear,
dm-flakey, dm-crypt). For this case, the target *must* use the same zone
size as the underlying devices and all devices used for the target must
have the same zone size.
2) A zoned device can be used to create a *regular* device target (e.g.
dm-zoned). All zoned devices used for the target must have the same zone size.
This new target driver completely breaks (1) and does not fit with (2). I
suspect this is why you are seeing problems with dm_revalidate_zones() as
that one uses the underlying device instead of the target report zones.
Based on this analysis, validate_hardware_zoned_model() definitely needs
to be changed. But device_not_matches_zone_sectors() is to check the
assumptions (1) and (2) so changing it for your new case is wrong in my
opinion. You need another set of assumptions (3) (define that well please)
and modify validate_hardware_zoned_model() so that the defined constraints
are checked. Using a target flag to indicate the type of zoned target is
fine by me.
--
Damien Le Moal
Western Digital Research
Powered by blists - more mailing lists