Page MenuHomeFreeBSD

D45459.id139340.diff
No OneTemporary

D45459.id139340.diff

diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c
--- a/sys/dev/nvmf/host/nvmf.c
+++ b/sys/dev/nvmf/host/nvmf.c
@@ -733,44 +733,12 @@
return (0);
}
-void
-nvmf_rescan_ns(struct nvmf_softc *sc, uint32_t nsid)
+static void
+nvmf_rescan_ns_1(struct nvmf_softc *sc, uint32_t nsid,
+ const struct nvme_namespace_data *data)
{
- struct nvmf_completion_status status;
- struct nvme_namespace_data *data;
struct nvmf_namespace *ns;
- data = malloc(sizeof(*data), M_NVMF, M_WAITOK);
-
- nvmf_status_init(&status);
- nvmf_status_wait_io(&status);
- if (!nvmf_cmd_identify_namespace(sc, nsid, data, nvmf_complete,
- &status, nvmf_io_complete, &status, M_WAITOK)) {
- device_printf(sc->dev,
- "failed to send IDENTIFY namespace %u command\n", nsid);
- free(data, M_NVMF);
- return;
- }
- nvmf_wait_for_reply(&status);
-
- if (status.cqe.status != 0) {
- device_printf(sc->dev,
- "IDENTIFY namespace %u failed, status %#x\n", nsid,
- le16toh(status.cqe.status));
- free(data, M_NVMF);
- return;
- }
-
- if (status.io_error != 0) {
- device_printf(sc->dev,
- "IDENTIFY namespace %u failed with I/O error %d\n",
- nsid, status.io_error);
- free(data, M_NVMF);
- return;
- }
-
- nvme_namespace_data_swapbytes(data);
-
/* XXX: Needs locking around sc->ns[]. */
ns = sc->ns[nsid - 1];
if (data->nsze == 0) {
@@ -791,11 +759,51 @@
}
}
- free(data, M_NVMF);
-
nvmf_sim_rescan_ns(sc, nsid);
}
+void
+nvmf_rescan_ns(struct nvmf_softc *sc, uint32_t nsid)
+{
+ struct nvmf_completion_status status;
+ struct nvme_namespace_data *data;
+
+ data = malloc(sizeof(*data), M_NVMF, M_WAITOK);
+
+ nvmf_status_init(&status);
+ nvmf_status_wait_io(&status);
+ if (!nvmf_cmd_identify_namespace(sc, nsid, data, nvmf_complete,
+ &status, nvmf_io_complete, &status, M_WAITOK)) {
+ device_printf(sc->dev,
+ "failed to send IDENTIFY namespace %u command\n", nsid);
+ free(data, M_NVMF);
+ return;
+ }
+ nvmf_wait_for_reply(&status);
+
+ if (status.cqe.status != 0) {
+ device_printf(sc->dev,
+ "IDENTIFY namespace %u failed, status %#x\n", nsid,
+ le16toh(status.cqe.status));
+ free(data, M_NVMF);
+ return;
+ }
+
+ if (status.io_error != 0) {
+ device_printf(sc->dev,
+ "IDENTIFY namespace %u failed with I/O error %d\n",
+ nsid, status.io_error);
+ free(data, M_NVMF);
+ return;
+ }
+
+ nvme_namespace_data_swapbytes(data);
+
+ nvmf_rescan_ns_1(sc, nsid, data);
+
+ free(data, M_NVMF);
+}
+
int
nvmf_passthrough_cmd(struct nvmf_softc *sc, struct nvme_pt_command *pt,
bool admin)

File Metadata

Mime Type
text/plain
Expires
Thu, Aug 27, 12:31 PM (8 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37384493
Default Alt Text
D45459.id139340.diff (2 KB)

Event Timeline