public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Joel Granados <j.granados@samsung.com>
Cc: hch@lst.de, kbusch@kernel.org, joshi.k@samsung.com,
	linux-nvme@lists.infradead.org, gost.dev@samsung.com,
	k.jensen@samsung.com
Subject: Re: [PATCH v2 2/2] nvme: enable generic interface (/dev/ngXnY) for unknown command sets
Date: Mon, 13 Jun 2022 20:24:39 +0200	[thread overview]
Message-ID: <20220613182439.GA16349@lst.de> (raw)
In-Reply-To: <20220607134055.1742162-3-j.granados@samsung.com>

On Tue, Jun 07, 2022 at 03:40:55PM +0200, Joel Granados wrote:

>  static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
>  		struct nvme_ns_ids *ids)
>  {
> +	int ret = 0;
>  	struct nvme_ns *ns;
>  	struct gendisk *disk;
>  	struct nvme_id_ns *id;
> +	struct nvme_id_ns_cs_indep *indep_id;
>  	int node = ctrl->numa_node;
> +	bool cs_indep = nvme_ns_indep(ids);
>  
> -	if (nvme_identify_ns(ctrl, nsid, ids, &id))
> +	if (cs_indep)
> +		ret = nvme_identify_ns_cs_indep(ctrl, nsid, &indep_id);
> +	else
> +		ret = nvme_identify_ns(ctrl, nsid, ids, &id);

nvme_validate_or_alloc_ns already does the nvme_identify_ns_cs_indep, so
we should be able to reuse it or move it here.

> -	if (nvme_init_ns_head(ns, nsid, ids, id->nmic & NVME_NS_NMIC_SHARED))
> +	if (nvme_init_ns_head(ns, nsid, ids,
> +			      (cs_indep ? indep_id->nmic : id->nmic) & NVME_NS_NMIC_SHARED))

This is pretty ugly.  I think if there is no command set idepdent
structure supported, we should probably just fake one up based on the
legacy Identify Namespace.

> +	if (cs_indep)
> +		ret = nvme_update_ns_info_cs_indep(ns, indep_id);
> +	else
> +		ret = nvme_update_ns_info(ns, id);

And here we should do a switch on ids->csi ala:

	 switch (ids.csi) {
	 case NVME_CSI_NVM:
	 case NVME_CSI_ZNS:
	 	ret = nvme_update_ns_info_block(ns, id);
		break
	default:
		nvme_update_ns_info_generic(ns, iid);
		break;
	}


  reply	other threads:[~2022-06-13 18:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220607134309eucas1p1724cee80a5bc116c652e91422d474ccd@eucas1p1.samsung.com>
2022-06-07 13:40 ` [PATCH v2 0/2] nvme: Enable generic interface (/dev/ngX) for unknown command sets Joel Granados
2022-06-07 13:40   ` [PATCH v2 1/2] nvme-multipath: refactor nvme_mpath_add_disk Joel Granados
2022-06-13 18:16     ` Christoph Hellwig
2022-06-15  7:50       ` Joel Granados
2022-06-07 13:40   ` [PATCH v2 2/2] nvme: enable generic interface (/dev/ngXnY) for unknown command sets Joel Granados
2022-06-13 18:24     ` Christoph Hellwig [this message]
2022-06-15 11:20       ` Joel Granados
2022-06-15 14:50         ` Joel Granados
2022-06-22 14:11         ` Joel Granados

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=20220613182439.GA16349@lst.de \
    --to=hch@lst.de \
    --cc=gost.dev@samsung.com \
    --cc=j.granados@samsung.com \
    --cc=joshi.k@samsung.com \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    /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