# Re: \[PATCH v4 2/8\] nvme: cleanup zone information initialization

- From: Damien Le Moal \<hidden\>
- Date: 2021-01-28 09:30:08 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2021/01/6400600
- Thread: https://ratatoskr.run/linux-block/2021/01/6400577/t.md

```text
On 2021/01/28 18:17, Christoph Hellwig wrote:
>>  int nvme_revalidate_zones(struct nvme_ns *ns)
>>  {
>> -	struct request_queue *q = ns->queue;
>> -	int ret;
>> -
>> -	ret = blk_revalidate_disk_zones(ns->disk, NULL);
>> -	if (!ret)
>> -		blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
>> -	return ret;
>> +	return blk_revalidate_disk_zones(ns->disk, NULL);
> 
> We can just kill off nvme_revalidate_zones now and open code it in
> the caller as the stub is no needed now that blk_queue_is_zoned always
> return false for the !CONFIG_BLK_DEV_ZONED case.

I tried that first, but it did not work. I end up with
blk_revalidate_disk_zones() undefined error with !CONFIG_BLK_DEV_ZONED.
This is because blk_queue_is_zoned() is *not* stubbed for !CONFIG_BLK_DEV_ZONED.
It will simply always return 0/none in that case. We would need to have:

if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && blk_queue_is_zoned()) {
	ret = blk_revalidate_disk_zones(ns->disk, NULL);
	...

Or stub blk_queue_is_zoned()...

> 
> Otherwise this look great, nice cleanup:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 


-- 
Damien Le Moal
Western Digital Research
```
