Commit 92f7a162 authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe

NVMe: Use unbounded work queue for all work

Removes all usage of the global work queue so work can't be
scheduled on two different work queues, and removes nvme's work queue
singlethreadedness so controllers can be driven in parallel.
Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
[hch: keep the dead controller removal on the system workqueue to avoid
 deadlocks]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 540c801c
...@@ -371,7 +371,7 @@ static void async_req_completion(struct nvme_queue *nvmeq, void *ctx, ...@@ -371,7 +371,7 @@ static void async_req_completion(struct nvme_queue *nvmeq, void *ctx,
switch (result & 0xff07) { switch (result & 0xff07) {
case NVME_AER_NOTICE_NS_CHANGED: case NVME_AER_NOTICE_NS_CHANGED:
dev_info(nvmeq->q_dmadev, "rescanning\n"); dev_info(nvmeq->q_dmadev, "rescanning\n");
schedule_work(&nvmeq->dev->scan_work); queue_work(nvme_workq, &nvmeq->dev->scan_work);
default: default:
dev_warn(nvmeq->q_dmadev, "async event result %08x\n", result); dev_warn(nvmeq->q_dmadev, "async event result %08x\n", result);
} }
...@@ -1782,7 +1782,7 @@ static int nvme_dev_add(struct nvme_dev *dev) ...@@ -1782,7 +1782,7 @@ static int nvme_dev_add(struct nvme_dev *dev)
return 0; return 0;
dev->ctrl.tagset = &dev->tagset; dev->ctrl.tagset = &dev->tagset;
} }
schedule_work(&dev->scan_work); queue_work(nvme_workq, &dev->scan_work);
return 0; return 0;
} }
...@@ -2331,7 +2331,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2331,7 +2331,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (result) if (result)
goto release_pools; goto release_pools;
schedule_work(&dev->reset_work); queue_work(nvme_workq, &dev->reset_work);
return 0; return 0;
release_pools: release_pools:
...@@ -2352,7 +2352,7 @@ static void nvme_reset_notify(struct pci_dev *pdev, bool prepare) ...@@ -2352,7 +2352,7 @@ static void nvme_reset_notify(struct pci_dev *pdev, bool prepare)
if (prepare) if (prepare)
nvme_dev_shutdown(dev); nvme_dev_shutdown(dev);
else else
schedule_work(&dev->reset_work); queue_work(nvme_workq, &dev->reset_work);
} }
static void nvme_shutdown(struct pci_dev *pdev) static void nvme_shutdown(struct pci_dev *pdev)
...@@ -2403,7 +2403,7 @@ static int nvme_resume(struct device *dev) ...@@ -2403,7 +2403,7 @@ static int nvme_resume(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct nvme_dev *ndev = pci_get_drvdata(pdev); struct nvme_dev *ndev = pci_get_drvdata(pdev);
schedule_work(&ndev->reset_work); queue_work(nvme_workq, &ndev->reset_work);
return 0; return 0;
} }
#endif #endif
...@@ -2451,7 +2451,7 @@ static int __init nvme_init(void) ...@@ -2451,7 +2451,7 @@ static int __init nvme_init(void)
init_waitqueue_head(&nvme_kthread_wait); init_waitqueue_head(&nvme_kthread_wait);
nvme_workq = create_singlethread_workqueue("nvme"); nvme_workq = alloc_workqueue("nvme", WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
if (!nvme_workq) if (!nvme_workq)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment