Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168128518
D45459.id139340.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D45459.id139340.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D45459: nvmf: Factor out most of nvmf_rescan_ns into a helper routine
Attached
Detach File
Event Timeline
Log In to Comment