From: Keith Busch <kbusch@kernel.org>
To: "Matias Bjørling" <m@bjorling.me>
Cc: hch@lst.de, dlemoal@kernel.org, cassel@kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Matias Bjørling" <matias.bjorling@wdc.com>
Subject: Re: [PATCH 0/2] nvme: add rotational support
Date: Tue, 8 Oct 2024 16:04:22 -0600 [thread overview]
Message-ID: <ZwWsZvOrQGQ2UR2P@kbusch-mbp> (raw)
In-Reply-To: <ZwVMLIt4iFX9MUjV@kbusch-mbp>
On Tue, Oct 08, 2024 at 09:13:48AM -0600, Keith Busch wrote:
> I still hope to see nvmet report this. It would be great to test this
> with HDD backed nvme-loop target.
I took the liberty to write one up. Looks like everything is reporting
as expected.
---
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 954d4c0747704..e167c9a2ff995 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -685,6 +685,35 @@ static void nvmet_execute_identify_ctrl_nvm(struct nvmet_req *req)
nvmet_zero_sgl(req, 0, sizeof(struct nvme_id_ctrl_nvm)));
}
+static void nvmet_execute_id_cs_indep(struct nvmet_req *req)
+{
+ struct nvme_id_ns_cs_indep *id;
+ u16 status;
+
+ status = nvmet_req_find_ns(req);
+ if (status)
+ goto out;
+
+ id = kzalloc(sizeof(*id), GFP_KERNEL);
+ if (!id) {
+ status = NVME_SC_INTERNAL;
+ goto out;
+ }
+
+ id->nstat = NVME_NSTAT_NRDY;
+ id->anagrpid = req->ns->anagrpid;
+ id->nmic = NVME_NS_NMIC_SHARED;
+ if (req->ns->readonly)
+ id->nsattr |= NVME_NS_ATTR_RO;
+ if (req->ns->bdev && !bdev_nonrot(req->ns->bdev))
+ id->nsfeat |= NVME_NS_ROTATIONAL;
+
+ status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
+ kfree(id);
+out:
+ nvmet_req_complete(req, status);
+}
+
static void nvmet_execute_identify(struct nvmet_req *req)
{
if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE))
@@ -729,6 +758,9 @@ static void nvmet_execute_identify(struct nvmet_req *req)
break;
}
break;
+ case NVME_ID_CNS_NS_CS_INDEP:
+ nvmet_execute_id_cs_indep(req);
+ return;
}
pr_debug("unhandled identify cns %d on qid %d\n",
--
next prev parent reply other threads:[~2024-10-08 22:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 14:55 [PATCH 0/2] nvme: add rotational support Matias Bjørling
2024-10-08 14:55 ` [PATCH 1/2] nvme: make independent ns identify default Matias Bjørling
2024-10-09 6:16 ` Hannes Reinecke
2024-10-09 13:59 ` Matias Bjørling
2024-10-09 7:46 ` Christoph Hellwig
2024-10-09 13:19 ` Matias Bjørling
2024-10-10 14:47 ` Daniel Wagner
2024-10-10 15:02 ` Matias Bjørling
2024-10-09 14:56 ` Keith Busch
2024-10-10 7:53 ` Christoph Hellwig
2024-10-08 14:55 ` [PATCH 2/2] nvme: add rotational support Matias Bjørling
2024-10-09 6:17 ` Hannes Reinecke
2024-10-09 7:48 ` Christoph Hellwig
2024-10-09 13:09 ` Matias Bjørling
2024-10-08 15:13 ` [PATCH 0/2] " Keith Busch
2024-10-08 22:04 ` Keith Busch [this message]
2024-10-09 12:56 ` Matias Bjørling
2024-10-08 15:26 ` Martin K. Petersen
2024-10-09 7:43 ` Christoph Hellwig
2024-10-09 13:27 ` Matias Bjørling
2024-10-09 15:39 ` Keith Busch
2024-10-09 18:04 ` Matias Bjørling
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=ZwWsZvOrQGQ2UR2P@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=m@bjorling.me \
--cc=matias.bjorling@wdc.com \
/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