* [PATCHv2] nvme: fixup zns namespace initialisation
@ 2024-05-24 6:18 ` Hannes Reinecke
2024-05-24 7:36 ` Christoph Hellwig
2024-05-24 7:58 ` Nitesh Shetty
0 siblings, 2 replies; 3+ messages in thread
From: Hannes Reinecke @ 2024-05-24 6:18 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Keith Busch, Sagi Grimberg, Damien LeMoal, linux-nvme,
Hannes Reinecke
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@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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCHv2] nvme: fixup zns namespace initialisation
2024-05-24 6:18 ` [PATCHv2] nvme: fixup zns namespace initialisation Hannes Reinecke
@ 2024-05-24 7:36 ` Christoph Hellwig
2024-05-24 7:58 ` Nitesh Shetty
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2024-05-24 7:36 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Christoph Hellwig, Keith Busch, Sagi Grimberg, Damien LeMoal,
linux-nvme
On Fri, May 24, 2024 at 08:18:08AM +0200, Hannes Reinecke wrote:
> 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.
It doesn't really "need to know it". It's kinda handy to warn if
a zone namespace sets an IOB.
> 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")
Even before that commit, nvme_update_zone_info is clearly called only
after nvme_set_chunk_sectors. The order goes back to
73d90386b559d6f4c3c5db5e6bb1b68aae8fd3e7 as far as I can tell.
Note that until the atomic limits series we kinda had to do it that
way as nvme_update_zone_info needs the sector size and other earlier
information.
The changes themselves looks fine, though:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: nvme: fixup zns namespace initialisation
2024-05-24 6:18 ` [PATCHv2] nvme: fixup zns namespace initialisation Hannes Reinecke
2024-05-24 7:36 ` Christoph Hellwig
@ 2024-05-24 7:58 ` Nitesh Shetty
1 sibling, 0 replies; 3+ messages in thread
From: Nitesh Shetty @ 2024-05-24 7:58 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Christoph Hellwig, Keith Busch, Sagi Grimberg, Damien LeMoal,
linux-nvme
[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]
On 24/05/24 08:18AM, Hannes Reinecke wrote:
>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@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);
Reviewed-by: Nitesh Shetty <nj.shetty@samsung.com>
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-24 9:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240524080511epcas5p311957ded505b60f89d19355b15193600@epcas5p3.samsung.com>
2024-05-24 6:18 ` [PATCHv2] nvme: fixup zns namespace initialisation Hannes Reinecke
2024-05-24 7:36 ` Christoph Hellwig
2024-05-24 7:58 ` Nitesh Shetty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox