Re: [PATCH v7 13/13] dm: add non power of 2 zoned target

From: Pankaj Raghav
Date: Fri Jun 17 2022 - 02:41:22 EST


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().