Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154195903
D51389.id158696.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
D51389.id158696.diff
View Options
diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c
--- a/sys/dev/nvd/nvd.c
+++ b/sys/dev/nvd/nvd.c
@@ -524,14 +524,6 @@
TAILQ_INSERT_TAIL(&ctrlr_head, nvd_ctrlr, tailq);
mtx_unlock(&nvd_lock);
- for (int i = 0; i < min(ctrlr->cdata.nn, NVME_MAX_NAMESPACES); i++) {
- struct nvme_namespace *ns = &ctrlr->ns[i];
-
- if (ns->data.nsze == 0)
- continue;
- nvd_new_disk(ns, nvd_ctrlr);
- }
-
return (0);
}
diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c
--- a/sys/dev/nvme/nvme.c
+++ b/sys/dev/nvme/nvme.c
@@ -170,18 +170,6 @@
}
}
-void
-nvme_notify_new_controller(struct nvme_controller *ctrlr)
-{
- int i;
-
- for (i = 0; i < NVME_MAX_CONSUMERS; i++) {
- if (nvme_consumer[i].id != INVALID_CONSUMER_ID) {
- nvme_notify(&nvme_consumer[i], ctrlr);
- }
- }
-}
-
static void
nvme_notify_new_consumer(struct nvme_consumer *cons)
{
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -45,6 +45,8 @@
#include "nvme_private.h"
#include "nvme_linux.h"
+#include "nvmec_if.h"
+
#define B4_CHK_RDY_DELAY_MS 2300 /* work around controller bug */
static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr,
@@ -1181,10 +1183,20 @@
device_t child;
ctrlr->is_initialized = true;
- nvme_notify_new_controller(ctrlr);
child = device_add_child(ctrlr->dev, NULL, DEVICE_UNIT_ANY);
device_set_ivars(child, ctrlr);
bus_attach_children(ctrlr->dev);
+
+ /*
+ * Now notify the child of all the known namepsaces
+ */
+ for (int i = 0; i < min(ctrlr->cdata.nn, NVME_MAX_NAMESPACES); i++) {
+ struct nvme_namespace *ns = &ctrlr->ns[i];
+
+ if (ns->data.nsze == 0)
+ continue;
+ NVMEC_NEW_NS(child, ns);
+ }
}
TSEXIT();
}
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -560,7 +560,6 @@
uint32_t log_page_id, void *log_page_buffer,
uint32_t log_page_size);
void nvme_notify_fail_consumers(struct nvme_controller *ctrlr);
-void nvme_notify_new_controller(struct nvme_controller *ctrlr);
void nvme_notify_ns(struct nvme_controller *ctrlr, int nsid);
void nvme_ctrlr_shared_handler(void *arg);
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -371,14 +371,6 @@
goto err3;
}
- for (int i = 0; i < min(ctrlr->cdata.nn, NVME_MAX_NAMESPACES); i++) {
- struct nvme_namespace *ns = &ctrlr->ns[i];
-
- if (ns->data.nsze == 0)
- continue;
- nvme_sim_ns_change(ns, sc);
- }
-
return (0);
err3:
xpt_bus_deregister(cam_sim_path(sc->s_sim));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 28, 12:37 AM (16 h, 19 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32244925
Default Alt Text
D51389.id158696.diff (2 KB)
Attached To
Mode
D51389: nvme: Hoist namespace notification into nvme driver
Attached
Detach File
Event Timeline
Log In to Comment