Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <kbusch@kernel.org>,
	Damien LeMoal <dlemoal@kernel.org>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme: fixup zns namespace initialisation
Date: Thu, 23 May 2024 14:44:45 +0200	[thread overview]
Message-ID: <20240523124445.GA20879@lst.de> (raw)
In-Reply-To: <20240523115810.133470-1-hare@kernel.org>

On Thu, May 23, 2024 at 01:58:10PM +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.

Where "needs to know" means the blk_queue_is_zoned check to warn if
an I/O boundary is set for a zoned namespaces? 

> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1952,6 +1952,12 @@ static void nvme_set_ctrl_limits(struct nvme_ctrl *ctrl,
>  	lim->virt_boundary_mask = NVME_CTRL_PAGE_SIZE - 1;
>  	lim->max_segment_size = UINT_MAX;
>  	lim->dma_alignment = 3;
> +	lim->chunk_sectors = 0;
> +	lim->zoned = false;
> +	lim->max_open_zones = 0;
> +	lim->max_active_zones = 0;
> +	lim->zone_write_granularity = 0;
> +	lim->max_zone_append_sectors = 0;

I can't see why we'd need or want this part.

>  static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
> @@ -2115,13 +2121,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);

This part looks fine, but you probably also want to replace the
blk_queue_is_zoned() check with one for lim->zoned for this to
actually work..



      reply	other threads:[~2024-05-23 12:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 11:58 [PATCH] nvme: fixup zns namespace initialisation Hannes Reinecke
2024-05-23 12:44 ` Christoph Hellwig [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240523124445.GA20879@lst.de \
    --to=hch@lst.de \
    --cc=dlemoal@kernel.org \
    --cc=hare@kernel.org \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox