Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F169155671
D45459.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45459.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,12 +733,40 @@
return (0);
}
+static void
+nvmf_rescan_ns_1(struct nvmf_softc *sc, uint32_t nsid,
+ const struct nvme_namespace_data *data)
+{
+ struct nvmf_namespace *ns;
+
+ /* XXX: Needs locking around sc->ns[]. */
+ ns = sc->ns[nsid - 1];
+ if (data->nsze == 0) {
+ /* XXX: Needs locking */
+ if (ns != NULL) {
+ nvmf_destroy_ns(ns);
+ sc->ns[nsid - 1] = NULL;
+ }
+ } else {
+ /* XXX: Needs locking */
+ if (ns == NULL) {
+ sc->ns[nsid - 1] = nvmf_init_ns(sc, nsid, data);
+ } else {
+ if (!nvmf_update_ns(ns, data)) {
+ nvmf_destroy_ns(ns);
+ sc->ns[nsid - 1] = NULL;
+ }
+ }
+ }
+
+ 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;
- struct nvmf_namespace *ns;
data = malloc(sizeof(*data), M_NVMF, M_WAITOK);
@@ -771,29 +799,9 @@
nvme_namespace_data_swapbytes(data);
- /* XXX: Needs locking around sc->ns[]. */
- ns = sc->ns[nsid - 1];
- if (data->nsze == 0) {
- /* XXX: Needs locking */
- if (ns != NULL) {
- nvmf_destroy_ns(ns);
- sc->ns[nsid - 1] = NULL;
- }
- } else {
- /* XXX: Needs locking */
- if (ns == NULL) {
- sc->ns[nsid - 1] = nvmf_init_ns(sc, nsid, data);
- } else {
- if (!nvmf_update_ns(ns, data)) {
- nvmf_destroy_ns(ns);
- sc->ns[nsid - 1] = NULL;
- }
- }
- }
+ nvmf_rescan_ns_1(sc, nsid, data);
free(data, M_NVMF);
-
- nvmf_sim_rescan_ns(sc, nsid);
}
int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 1, 3:05 PM (8 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37732026
Default Alt Text
D45459.diff (1 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