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

From
Damien Le Moal <hidden>
Date
2021-01-28 09:30:08
Also in
linux-nvme, linux-scsi
Reply to
Christoph Hellwig, 2021-01-28
On 2021/01/28 18:17, Christoph Hellwig wrote:
quoted
 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
Thread (36 messages) 36 messages, 5 authors, last reply 2021-02-10
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help