All of lore.kernel.org
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 10/10] nvmet: set 'nuse' and 'nsze' to zero for inaccessible paths
Date: Tue, 29 May 2018 14:57:13 +0200	[thread overview]
Message-ID: <20180529125713.GJ7376@lst.de> (raw)
In-Reply-To: <20180529101431.62271-11-hare@suse.de>

On Tue, May 29, 2018@12:14:31PM +0200, Hannes Reinecke wrote:
> According to the ANA base specification the 'nuse' and 'nsze' values
> can be set to '0' for 'inaccessible' or 'persistent-loss' path states.

No.  It applies to NUSE and NVMCAP.  We don't report NVMCAP, so we
only need this tweak for NUSE.

> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -371,6 +371,18 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req)
>  	id->ncap = id->nuse = id->nsze =
>  		cpu_to_le64(ns->size >> ns->blksize_shift);
>  
> +	if (ns->anagrpid) {
> +		enum nvme_ana_state ana_state =
> +			req->port->ana_state[ns->anagrpid];
> +
> +		/*
> +		 * nuse and nsze should be zero for inaccessible or
> +		 * persistent loss ANA state.
> +		 */
> +		if ((ana_state == NVME_ANA_INACCESSIBLE) ||
> +		    (ana_state == NVME_ANA_PERSISTENT_LOSS))

Please remove the inner braces.

We don't need the anagrpid check, because we a) always set it to
a non-zero value, and b) would not be able to have a non-optimized
state anyway.

So just something like:

	id->ncap = id->nsze = cpu_to_le64(ns->size >> ns->blksize_shift);

	switch (req->port->ana_state[ns->anagrpid]) {
	case NVME_ANA_INACCESSIBLE:
	case NVME_ANA_PERSISTENT_LOSS:
		break;
	default:
		id->nuse = id->nsze;
		break;
	}

  reply	other threads:[~2018-05-29 12:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 10:14 [PATCH 00/10] nvme: ANA fixups Hannes Reinecke
2018-05-29 10:14 ` [PATCH 01/10] nvme: add missing kfree() in nvme_configure_ana() Hannes Reinecke
2018-05-29 12:16   ` Johannes Thumshirn
2018-05-29 12:39   ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 02/10] nvme: ANA transition timeout handling Hannes Reinecke
2018-05-29 12:47   ` Christoph Hellwig
2018-05-29 13:34     ` Hannes Reinecke
2018-05-29 13:47       ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 03/10] nvme: Only update capacity for optimized or non-optimized paths Hannes Reinecke
2018-05-29 12:38   ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 04/10] nvme: clear current path on ANA state change Hannes Reinecke
2018-05-29 12:22   ` Johannes Thumshirn
2018-05-29 12:43     ` Hannes Reinecke
2018-05-29 12:48   ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 05/10] nvme: retry nvme_get_log_ext() when processing ANA log Hannes Reinecke
2018-05-29 12:48   ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 06/10] nvme: simplify check for ANA in nvme_ns_id_attrs_are_visible() Hannes Reinecke
2018-05-29 12:49   ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 07/10] nvmet: make ANATT configurable Hannes Reinecke
2018-05-29 12:50   ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 08/10] nvmet: Set nanagrpid correctly Hannes Reinecke
2018-05-29 12:51   ` Christoph Hellwig
2018-05-29 13:04     ` Hannes Reinecke
2018-05-29 13:38       ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 09/10] nvmet: Set mnan correctly Hannes Reinecke
2018-05-29 12:52   ` Christoph Hellwig
2018-05-29 13:06     ` Hannes Reinecke
2018-05-29 13:40       ` Christoph Hellwig
2018-05-29 10:14 ` [PATCH 10/10] nvmet: set 'nuse' and 'nsze' to zero for inaccessible paths Hannes Reinecke
2018-05-29 12:57   ` Christoph Hellwig [this message]
2018-05-31 10:30 ` [PATCH 00/10] nvme: ANA fixups Sagi Grimberg
2018-05-31 16:26   ` Christoph Hellwig

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=20180529125713.GJ7376@lst.de \
    --to=hch@lst.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.