Merge tag 'v4.18-rc6' into for-4.19/block2
[linux-2.6-microblaze.git] / drivers / nvme / target / core.c
index 74d4b78..ddd8571 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "nvmet.h"
 
+struct workqueue_struct *buffered_io_wq;
 static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
 static DEFINE_IDA(cntlid_ida);
 
@@ -241,6 +242,10 @@ int nvmet_enable_port(struct nvmet_port *port)
                return ret;
        }
 
+       /* If the transport didn't set inline_data_size, then disable it. */
+       if (port->inline_data_size < 0)
+               port->inline_data_size = 0;
+
        port->enabled = true;
        return 0;
 }
@@ -437,6 +442,7 @@ struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid)
        ns->nsid = nsid;
        ns->subsys = subsys;
        uuid_gen(&ns->uuid);
+       ns->buffered_io = false;
 
        return ns;
 }
@@ -1109,6 +1115,12 @@ static int __init nvmet_init(void)
 {
        int error;
 
+       buffered_io_wq = alloc_workqueue("nvmet-buffered-io-wq",
+                       WQ_MEM_RECLAIM, 0);
+       if (!buffered_io_wq) {
+               error = -ENOMEM;
+               goto out;
+       }
        error = nvmet_init_discovery();
        if (error)
                goto out;
@@ -1129,6 +1141,7 @@ static void __exit nvmet_exit(void)
        nvmet_exit_configfs();
        nvmet_exit_discovery();
        ida_destroy(&cntlid_ida);
+       destroy_workqueue(buffered_io_wq);
 
        BUILD_BUG_ON(sizeof(struct nvmf_disc_rsp_page_entry) != 1024);
        BUILD_BUG_ON(sizeof(struct nvmf_disc_rsp_page_hdr) != 1024);