All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] move nvme_cancel_io() to common code
@ 2016-05-18  5:56 Ming Lin
  2016-05-18  5:56 ` [PATCH 1/2] nvme: update nvme_cancel_io() a bit Ming Lin
  2016-05-18  5:56 ` [PATCH 2/2] nvme: move nvme_cancel_io() to core.c Ming Lin
  0 siblings, 2 replies; 5+ messages in thread
From: Ming Lin @ 2016-05-18  5:56 UTC (permalink / raw)


From: Ming Lin <ming.l@samsung.com>

So it can be used by fabrics driver also.

Ming Lin (2):
  nvme: update nvme_cancel_io() a bit
  nvme: move nvme_cancel_io() to core.c

 drivers/nvme/host/core.c | 17 +++++++++++++++++
 drivers/nvme/host/nvme.h |  1 +
 drivers/nvme/host/pci.c  | 20 ++------------------
 3 files changed, 20 insertions(+), 18 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] nvme: update nvme_cancel_io() a bit
  2016-05-18  5:56 [PATCH 0/2] move nvme_cancel_io() to common code Ming Lin
@ 2016-05-18  5:56 ` Ming Lin
  2016-05-18 15:11   ` Keith Busch
  2016-05-18  5:56 ` [PATCH 2/2] nvme: move nvme_cancel_io() to core.c Ming Lin
  1 sibling, 1 reply; 5+ messages in thread
From: Ming Lin @ 2016-05-18  5:56 UTC (permalink / raw)


From: Ming Lin <ming.l@samsung.com>

Pass in nvme_ctrl, so it can be used by Fabrics driver also.

Signed-off-by: Ming Lin <ming.l at samsung.com>
Reviewed-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index a62c9c5..a2481ff 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -927,13 +927,13 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 
 static void nvme_cancel_io(struct request *req, void *data, bool reserved)
 {
+	struct nvme_ctrl *ctrl = data;
 	int status;
 
 	if (!blk_mq_request_started(req))
 		return;
 
-	dev_dbg_ratelimited(((struct nvme_dev *) data)->ctrl.device,
-				"Cancelling I/O %d", req->tag);
+	dev_dbg_ratelimited(ctrl->device, "Cancelling I/O %d", req->tag);
 
 	status = NVME_SC_ABORT_REQ;
 	if (blk_queue_dying(req->q))
@@ -1720,8 +1720,8 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
 	}
 	nvme_pci_disable(dev);
 
-	blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_io, dev);
-	blk_mq_tagset_busy_iter(&dev->admin_tagset, nvme_cancel_io, dev);
+	blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_io, &dev->ctrl);
+	blk_mq_tagset_busy_iter(&dev->admin_tagset, nvme_cancel_io, &dev->ctrl);
 	mutex_unlock(&dev->shutdown_lock);
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] nvme: move nvme_cancel_io() to core.c
  2016-05-18  5:56 [PATCH 0/2] move nvme_cancel_io() to common code Ming Lin
  2016-05-18  5:56 ` [PATCH 1/2] nvme: update nvme_cancel_io() a bit Ming Lin
@ 2016-05-18  5:56 ` Ming Lin
  1 sibling, 0 replies; 5+ messages in thread
From: Ming Lin @ 2016-05-18  5:56 UTC (permalink / raw)


From: Ming Lin <ming.l@samsung.com>

So it can be used by Fabrics driver also.

Signed-off-by: Ming Lin <ming.l at samsung.com>
Reviewed-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/core.c | 17 +++++++++++++++++
 drivers/nvme/host/nvme.h |  1 +
 drivers/nvme/host/pci.c  | 16 ----------------
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ac950d1..4f971ed 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -59,6 +59,23 @@ static DEFINE_SPINLOCK(dev_list_lock);
 
 static struct class *nvme_class;
 
+void nvme_cancel_io(struct request *req, void *data, bool reserved)
+{
+	struct nvme_ctrl *ctrl = data;
+	int status;
+
+	if (!blk_mq_request_started(req))
+		return;
+
+	dev_dbg_ratelimited(ctrl->device, "Cancelling I/O %d", req->tag);
+
+	status = NVME_SC_ABORT_REQ;
+	if (blk_queue_dying(req->q))
+		status |= NVME_SC_DNR;
+	blk_mq_complete_request(req, status);
+}
+EXPORT_SYMBOL_GPL(nvme_cancel_io);
+
 bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
 		enum nvme_ctrl_state new_state)
 {
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index fab6507..ff234bd 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -229,6 +229,7 @@ static inline bool nvme_req_needs_retry(struct request *req, u16 status)
 		(jiffies - req->start_time) < req->timeout;
 }
 
+void nvme_cancel_io(struct request *req, void *data, bool reserved);
 bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
 		enum nvme_ctrl_state new_state);
 int nvme_disable_ctrl(struct nvme_ctrl *ctrl, u64 cap);
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index a2481ff..d3471e4 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -925,22 +925,6 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	return BLK_EH_RESET_TIMER;
 }
 
-static void nvme_cancel_io(struct request *req, void *data, bool reserved)
-{
-	struct nvme_ctrl *ctrl = data;
-	int status;
-
-	if (!blk_mq_request_started(req))
-		return;
-
-	dev_dbg_ratelimited(ctrl->device, "Cancelling I/O %d", req->tag);
-
-	status = NVME_SC_ABORT_REQ;
-	if (blk_queue_dying(req->q))
-		status |= NVME_SC_DNR;
-	blk_mq_complete_request(req, status);
-}
-
 static void nvme_free_queue(struct nvme_queue *nvmeq)
 {
 	dma_free_coherent(nvmeq->q_dmadev, CQ_SIZE(nvmeq->q_depth),
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/2] nvme: update nvme_cancel_io() a bit
  2016-05-18  5:56 ` [PATCH 1/2] nvme: update nvme_cancel_io() a bit Ming Lin
@ 2016-05-18 15:11   ` Keith Busch
  2016-05-18 20:23     ` Ming Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Busch @ 2016-05-18 15:11 UTC (permalink / raw)


On Tue, May 17, 2016@10:56:58PM -0700, Ming Lin wrote:
>  static void nvme_cancel_io(struct request *req, void *data, bool reserved)
>  {
> +	struct nvme_ctrl *ctrl = data;
>  	int status;
>  
>  	if (!blk_mq_request_started(req))
>  		return;
>  
> -	dev_dbg_ratelimited(((struct nvme_dev *) data)->ctrl.device,
> -				"Cancelling I/O %d", req->tag);
> +	dev_dbg_ratelimited(ctrl->device, "Cancelling I/O %d", req->tag);

Since you're not using ctrl for anything but the debug print, you
should remove declaring it and instead do like what's currently there.
This way the driver doesn't produce an unused variable warning in some
kernel configurations. See commit 7e197930 that fixed this before.

Otherwise, looks fine.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] nvme: update nvme_cancel_io() a bit
  2016-05-18 15:11   ` Keith Busch
@ 2016-05-18 20:23     ` Ming Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Ming Lin @ 2016-05-18 20:23 UTC (permalink / raw)


On Wed, May 18, 2016@8:11 AM, Keith Busch <keith.busch@intel.com> wrote:
> On Tue, May 17, 2016@10:56:58PM -0700, Ming Lin wrote:
>>  static void nvme_cancel_io(struct request *req, void *data, bool reserved)
>>  {
>> +     struct nvme_ctrl *ctrl = data;
>>       int status;
>>
>>       if (!blk_mq_request_started(req))
>>               return;
>>
>> -     dev_dbg_ratelimited(((struct nvme_dev *) data)->ctrl.device,
>> -                             "Cancelling I/O %d", req->tag);
>> +     dev_dbg_ratelimited(ctrl->device, "Cancelling I/O %d", req->tag);
>
> Since you're not using ctrl for anything but the debug print, you
> should remove declaring it and instead do like what's currently there.
> This way the driver doesn't produce an unused variable warning in some
> kernel configurations. See commit 7e197930 that fixed this before.

Will update. Thanks.

>
> Otherwise, looks fine.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-18 20:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18  5:56 [PATCH 0/2] move nvme_cancel_io() to common code Ming Lin
2016-05-18  5:56 ` [PATCH 1/2] nvme: update nvme_cancel_io() a bit Ming Lin
2016-05-18 15:11   ` Keith Busch
2016-05-18 20:23     ` Ming Lin
2016-05-18  5:56 ` [PATCH 2/2] nvme: move nvme_cancel_io() to core.c Ming Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.