|
@@ -92,7 +92,6 @@ struct nvme_dev {
|
|
struct msix_entry *entry;
|
|
struct msix_entry *entry;
|
|
void __iomem *bar;
|
|
void __iomem *bar;
|
|
struct work_struct reset_work;
|
|
struct work_struct reset_work;
|
|
- struct work_struct scan_work;
|
|
|
|
struct work_struct remove_work;
|
|
struct work_struct remove_work;
|
|
struct work_struct async_work;
|
|
struct work_struct async_work;
|
|
struct timer_list watchdog_timer;
|
|
struct timer_list watchdog_timer;
|
|
@@ -266,16 +265,6 @@ static int nvme_init_request(void *data, struct request *req,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static void nvme_queue_scan(struct nvme_dev *dev)
|
|
|
|
-{
|
|
|
|
- /*
|
|
|
|
- * Do not queue new scan work when a controller is reset during
|
|
|
|
- * removal.
|
|
|
|
- */
|
|
|
|
- if (dev->ctrl.state == NVME_CTRL_LIVE)
|
|
|
|
- queue_work(nvme_workq, &dev->scan_work);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static void nvme_complete_async_event(struct nvme_dev *dev,
|
|
static void nvme_complete_async_event(struct nvme_dev *dev,
|
|
struct nvme_completion *cqe)
|
|
struct nvme_completion *cqe)
|
|
{
|
|
{
|
|
@@ -293,7 +282,7 @@ static void nvme_complete_async_event(struct nvme_dev *dev,
|
|
switch (result & 0xff07) {
|
|
switch (result & 0xff07) {
|
|
case NVME_AER_NOTICE_NS_CHANGED:
|
|
case NVME_AER_NOTICE_NS_CHANGED:
|
|
dev_info(dev->ctrl.device, "rescanning\n");
|
|
dev_info(dev->ctrl.device, "rescanning\n");
|
|
- nvme_queue_scan(dev);
|
|
|
|
|
|
+ nvme_queue_scan(&dev->ctrl);
|
|
default:
|
|
default:
|
|
dev_warn(dev->ctrl.device, "async event result %08x\n", result);
|
|
dev_warn(dev->ctrl.device, "async event result %08x\n", result);
|
|
}
|
|
}
|
|
@@ -1520,8 +1509,9 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
-static void nvme_set_irq_hints(struct nvme_dev *dev)
|
|
|
|
|
|
+static void nvme_pci_post_scan(struct nvme_ctrl *ctrl)
|
|
{
|
|
{
|
|
|
|
+ struct nvme_dev *dev = to_nvme_dev(ctrl);
|
|
struct nvme_queue *nvmeq;
|
|
struct nvme_queue *nvmeq;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
@@ -1536,16 +1526,6 @@ static void nvme_set_irq_hints(struct nvme_dev *dev)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void nvme_dev_scan(struct work_struct *work)
|
|
|
|
-{
|
|
|
|
- struct nvme_dev *dev = container_of(work, struct nvme_dev, scan_work);
|
|
|
|
-
|
|
|
|
- if (!dev->tagset.tags)
|
|
|
|
- return;
|
|
|
|
- nvme_scan_namespaces(&dev->ctrl);
|
|
|
|
- nvme_set_irq_hints(dev);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static void nvme_del_queue_end(struct request *req, int error)
|
|
static void nvme_del_queue_end(struct request *req, int error)
|
|
{
|
|
{
|
|
struct nvme_queue *nvmeq = req->end_io_data;
|
|
struct nvme_queue *nvmeq = req->end_io_data;
|
|
@@ -1894,7 +1874,7 @@ static void nvme_reset_work(struct work_struct *work)
|
|
}
|
|
}
|
|
|
|
|
|
if (dev->online_queues > 1)
|
|
if (dev->online_queues > 1)
|
|
- nvme_queue_scan(dev);
|
|
|
|
|
|
+ nvme_queue_scan(&dev->ctrl);
|
|
return;
|
|
return;
|
|
|
|
|
|
out:
|
|
out:
|
|
@@ -1954,6 +1934,7 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
|
|
.reg_read64 = nvme_pci_reg_read64,
|
|
.reg_read64 = nvme_pci_reg_read64,
|
|
.reset_ctrl = nvme_pci_reset_ctrl,
|
|
.reset_ctrl = nvme_pci_reset_ctrl,
|
|
.free_ctrl = nvme_pci_free_ctrl,
|
|
.free_ctrl = nvme_pci_free_ctrl,
|
|
|
|
+ .post_scan = nvme_pci_post_scan,
|
|
};
|
|
};
|
|
|
|
|
|
static int nvme_dev_map(struct nvme_dev *dev)
|
|
static int nvme_dev_map(struct nvme_dev *dev)
|
|
@@ -2005,7 +1986,6 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|
if (result)
|
|
if (result)
|
|
goto free;
|
|
goto free;
|
|
|
|
|
|
- INIT_WORK(&dev->scan_work, nvme_dev_scan);
|
|
|
|
INIT_WORK(&dev->reset_work, nvme_reset_work);
|
|
INIT_WORK(&dev->reset_work, nvme_reset_work);
|
|
INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work);
|
|
INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work);
|
|
INIT_WORK(&dev->async_work, nvme_async_event_work);
|
|
INIT_WORK(&dev->async_work, nvme_async_event_work);
|
|
@@ -2071,8 +2051,6 @@ static void nvme_remove(struct pci_dev *pdev)
|
|
|
|
|
|
pci_set_drvdata(pdev, NULL);
|
|
pci_set_drvdata(pdev, NULL);
|
|
flush_work(&dev->async_work);
|
|
flush_work(&dev->async_work);
|
|
- flush_work(&dev->scan_work);
|
|
|
|
- nvme_remove_namespaces(&dev->ctrl);
|
|
|
|
nvme_uninit_ctrl(&dev->ctrl);
|
|
nvme_uninit_ctrl(&dev->ctrl);
|
|
nvme_dev_disable(dev, true);
|
|
nvme_dev_disable(dev, true);
|
|
flush_work(&dev->reset_work);
|
|
flush_work(&dev->reset_work);
|