[PATCHv2] nvme: fixup zns namespace initialisation
Hannes Reinecke
hare at kernel.org
Thu May 23 23:18:08 PDT 2024
nvme_set_chunk_sectors() needs to know whether it's a zoned namespace
or not, but the information is only set in a later call.
So move the calls around and ensure that the namespace is marked as
non-zoned initially to avoid calculation errors when trying to derive
a non-existing zone geometry.
Fixes: c85c9ab926a5 ("nvme: split nvme_update_zone_info")
Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
drivers/nvme/host/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 111bf4197052..a968d33914a7 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2115,13 +2115,13 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
lim = queue_limits_start_update(ns->disk->queue);
nvme_set_ctrl_limits(ns->ctrl, &lim);
nvme_configure_metadata(ns->ctrl, ns->head, id, nvm);
+ if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
+ ns->head->ids.csi == NVME_CSI_ZNS)
+ nvme_update_zone_info(ns, &lim, &zi);
nvme_set_chunk_sectors(ns, id, &lim);
if (!nvme_update_disk_info(ns, id, &lim))
capacity = 0;
nvme_config_discard(ns, &lim);
- if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
- ns->head->ids.csi == NVME_CSI_ZNS)
- nvme_update_zone_info(ns, &lim, &zi);
ret = queue_limits_commit_update(ns->disk->queue, &lim);
if (ret) {
blk_mq_unfreeze_queue(ns->disk->queue);
--
2.35.3
More information about the Linux-nvme
mailing list