All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: add helper nvme_cleanup_cmd()
@ 2016-04-17  5:35 Ming Lin
  2016-04-17 18:08 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ming Lin @ 2016-04-17  5:35 UTC (permalink / raw)


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

This hides command cleanup into core.c and fabrics drivers will
also use it.

Signed-off-by: Ming Lin <ming.l at ssi.samsung.com>
---
 drivers/nvme/host/core.c | 7 +++++++
 drivers/nvme/host/nvme.h | 1 +
 drivers/nvme/host/pci.c  | 3 +--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4eb5759..7dd9905 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -243,6 +243,13 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
 }
 EXPORT_SYMBOL_GPL(nvme_setup_cmd);
 
+void nvme_cleanup_cmd(struct request *req)
+{
+	if (req->cmd_flags & REQ_DISCARD)
+		kfree(req->completion_data);
+}
+EXPORT_SYMBOL_GPL(nvme_cleanup_cmd);
+
 /*
  * Returns 0 on success.  If the result is negative, it's a Linux error code;
  * if the result is positive, it's an NVM Express status code
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 8e8fae8..4f9ddbf 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -220,6 +220,7 @@ struct request *nvme_alloc_request(struct request_queue *q,
 void nvme_requeue_req(struct request *req);
 int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
 		struct nvme_command *cmd);
+void nvme_cleanup_cmd(struct request *req);
 int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 		void *buf, unsigned bufflen);
 int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index ff3c8d7..0569cbf 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -363,8 +363,7 @@ static void nvme_free_iod(struct nvme_dev *dev, struct request *req)
 	__le64 **list = iod_list(req);
 	dma_addr_t prp_dma = iod->first_dma;
 
-	if (req->cmd_flags & REQ_DISCARD)
-		kfree(req->completion_data);
+	nvme_cleanup_cmd(req);
 
 	if (iod->npages == 0)
 		dma_pool_free(dev->prp_small_pool, list[0], prp_dma);
-- 
1.9.1

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

* [PATCH] nvme: add helper nvme_cleanup_cmd()
  2016-04-17  5:35 [PATCH] nvme: add helper nvme_cleanup_cmd() Ming Lin
@ 2016-04-17 18:08 ` Christoph Hellwig
  2016-04-18 15:28 ` Keith Busch
  2016-04-18 15:46 ` Sagi Grimberg
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-04-17 18:08 UTC (permalink / raw)


Looks good,

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

* [PATCH] nvme: add helper nvme_cleanup_cmd()
  2016-04-17  5:35 [PATCH] nvme: add helper nvme_cleanup_cmd() Ming Lin
  2016-04-17 18:08 ` Christoph Hellwig
@ 2016-04-18 15:28 ` Keith Busch
  2016-04-18 17:37   ` Ming Lin
  2016-04-18 15:46 ` Sagi Grimberg
  2 siblings, 1 reply; 5+ messages in thread
From: Keith Busch @ 2016-04-18 15:28 UTC (permalink / raw)


On Sat, Apr 16, 2016@10:35:46PM -0700, Ming Lin wrote:
> From: Ming Lin <ming.l at ssi.samsung.com>
> 
> This hides command cleanup into core.c and fabrics drivers will
> also use it.

Can we just make this a static inline in nvme.h instead of adding a
new export?

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

* [PATCH] nvme: add helper nvme_cleanup_cmd()
  2016-04-17  5:35 [PATCH] nvme: add helper nvme_cleanup_cmd() Ming Lin
  2016-04-17 18:08 ` Christoph Hellwig
  2016-04-18 15:28 ` Keith Busch
@ 2016-04-18 15:46 ` Sagi Grimberg
  2 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2016-04-18 15:46 UTC (permalink / raw)


Looks good,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

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

* [PATCH] nvme: add helper nvme_cleanup_cmd()
  2016-04-18 15:28 ` Keith Busch
@ 2016-04-18 17:37   ` Ming Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Ming Lin @ 2016-04-18 17:37 UTC (permalink / raw)


On Mon, Apr 18, 2016@8:28 AM, Keith Busch <keith.busch@intel.com> wrote:
> On Sat, Apr 16, 2016@10:35:46PM -0700, Ming Lin wrote:
>> From: Ming Lin <ming.l at ssi.samsung.com>
>>
>> This hides command cleanup into core.c and fabrics drivers will
>> also use it.
>
> Can we just make this a static inline in nvme.h instead of adding a
> new export?

OK to me. I'll send a new one if no objection.

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

end of thread, other threads:[~2016-04-18 17:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-17  5:35 [PATCH] nvme: add helper nvme_cleanup_cmd() Ming Lin
2016-04-17 18:08 ` Christoph Hellwig
2016-04-18 15:28 ` Keith Busch
2016-04-18 17:37   ` Ming Lin
2016-04-18 15:46 ` Sagi Grimberg

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.