linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: Christoph Hellwig <hch@lst.de>
Cc: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"sagi@grimberg.me" <sagi@grimberg.me>,
	Damien Le Moal <Damien.LeMoal@wdc.com>
Subject: Re: [PATCH V10 2/8] nvmet: add NVM Command Set Identifier support
Date: Tue, 9 Mar 2021 21:07:42 +0000	[thread overview]
Message-ID: <BYAPR04MB49651B71A703D3C807E0716686929@BYAPR04MB4965.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20210309113746.GB9520@lst.de

On 3/9/21 03:37, Christoph Hellwig wrote:
>> +static void nvmet_set_csi_nvm_effects(struct nvme_effects_log *log)
>>  {
>>  	log->acs[nvme_admin_get_log_page]	= cpu_to_le32(1 << 0);
>>  	log->acs[nvme_admin_identify]		= cpu_to_le32(1 << 0);
>>  	log->acs[nvme_admin_abort_cmd]		= cpu_to_le32(1 << 0);
>> @@ -184,8 +177,45 @@ static void nvmet_execute_get_log_cmd_effects_ns(struct nvmet_req *req)
>>  	log->iocs[nvme_cmd_flush]		= cpu_to_le32(1 << 0);
>>  	log->iocs[nvme_cmd_dsm]			= cpu_to_le32(1 << 0);
>>  	log->iocs[nvme_cmd_write_zeroes]	= cpu_to_le32(1 << 0);
>> +}
>>  
>> +static u16 nvmet_set_csi_zns_effects(struct nvme_effects_log *log)
>> +{
>> +	if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED))
>> +		return NVME_SC_INVALID_IO_CMD_SET;
> I'd move this check into the caller.

Okay.

>> +	switch (req->cmd->get_log_page.csi) {
>> +	case NVME_CSI_NVM:
>> +		nvmet_set_csi_nvm_effects(log);
>> +		break;
>> +	case NVME_CSI_ZNS:
>> +		status = nvmet_set_csi_zns_effects(log);
>> +		break;
> ZNS also needs a call to nvmet_set_csi_nvm_effects as it also supports
> the the NVM commands.  But more importantly the ZNS case does not
> belong into this patch at all, but into one that actually adds ZNS
> support.  CSI support is just infrastructure not tied to a new command
> set.  Same for all the other places referencing ZNS in this patch.
>

Okay, I'll move all the ZNS related code to the ZNS backend patch.

>> +	default:
>> +		status = NVME_SC_INVALID_LOG_PAGE;
>> +		break;
>> +	}
>> +
>> +	if (status == NVME_SC_SUCCESS)
>> +		status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log));
> Also I'd use a goto for the failure case instead of the check here.
> the 

Okay.

>> +	switch (req->ns->csi) {
>> +	case NVME_CSI_NVM:
>> +		status = nvmet_copy_ns_identifier(req, NVME_NIDT_CSI, o);
>> +		break;
>> +	case NVME_CSI_ZNS:
>> +		if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED))
>> +			return NVME_SC_INVALID_IO_CMD_SET;
>> +
>> +		status = nvmet_copy_ns_identifier(req, NVME_NIDT_CSI, o);
>> +		break;
>> +	default:
>> +		status = NVME_SC_INVALID_IO_CMD_SET;
>> +	}
>> +
>> +	return status;
> Just return directly from inside the switch statement to simplify this
> a bit.
>

Make sense.


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-03-09 21:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  4:58 [PATCH V10 0/8] nvmet: add ZBD backend support Chaitanya Kulkarni
2021-03-09  4:58 ` [PATCH V10 1/8] nvmet: trim args for nvmet_copy_ns_identifier() Chaitanya Kulkarni
2021-03-09 11:34   ` Christoph Hellwig
2021-03-09 20:54     ` Chaitanya Kulkarni
2021-03-09 21:03     ` Chaitanya Kulkarni
2021-03-10  8:49       ` Christoph Hellwig
2021-03-10  8:52         ` Chaitanya Kulkarni
2021-03-09  4:58 ` [PATCH V10 2/8] nvmet: add NVM Command Set Identifier support Chaitanya Kulkarni
2021-03-09 11:37   ` Christoph Hellwig
2021-03-09 21:07     ` Chaitanya Kulkarni [this message]
2021-03-09  4:58 ` [PATCH V10 3/8] nvmet: add command set supported ctrl cap Chaitanya Kulkarni
2021-03-09 11:38   ` Christoph Hellwig
2021-03-09 21:09     ` Chaitanya Kulkarni
2021-03-10  7:05   ` Chaitanya Kulkarni
2021-03-10  7:14     ` hch
2021-03-09  4:58 ` [PATCH V10 4/8] nvmet: add ZBD over ZNS backend support Chaitanya Kulkarni
2021-03-09 11:41   ` Christoph Hellwig
2021-03-09 21:13     ` Chaitanya Kulkarni
2021-03-09  4:58 ` [PATCH V10 5/8] nvmet: add nvmet_req_bio put helper for backends Chaitanya Kulkarni
2021-03-09  4:58 ` [PATCH V10 6/8] nvme-core: check ctrl css before setting up zns Chaitanya Kulkarni
2021-03-09 11:42   ` Christoph Hellwig
2021-03-09 15:03     ` Christoph Hellwig
2021-03-10  1:14       ` Chaitanya Kulkarni
2021-03-09  4:58 ` [PATCH V10 7/8] nvme-core: add a helper to print css related error Chaitanya Kulkarni
2021-03-09  4:58 ` [PATCH V10 8/8] nvme: add comments to nvme_zns_alloc_report_buffer Chaitanya Kulkarni

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=BYAPR04MB49651B71A703D3C807E0716686929@BYAPR04MB4965.namprd04.prod.outlook.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=hch@lst.de \
    --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;
as well as URLs for NNTP newsgroup(s).