linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matias Bjørling" <m@bjorling.me>
To: hch@infradead.org, axboe@fb.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: javier@paletta.io, keith.busch@intel.com,
	"Matias Bjørling" <m@bjorling.me>
Subject: [PATCH v3 6/7] nvme: rename and expose nvme_alloc_iod
Date: Wed, 22 Apr 2015 16:26:55 +0200	[thread overview]
Message-ID: <1429712816-10336-7-git-send-email-m@bjorling.me> (raw)
In-Reply-To: <1429712816-10336-1-git-send-email-m@bjorling.me>

From: Javier González <javier@paletta.io>

Users of the kernel interface of the NVMe driver are limited to sending
custom commands without iod's.

By renaming __nvme_alloc_iod to nvme_alloc_phys_seg_iod and expose it
through the header file, an outside translation layer such as scsi or
lightnvm can integrate commands with iod structure.

Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/block/nvme-core.c | 9 ++++-----
 include/linux/nvme.h      | 2 ++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index e23be20..8459fa8 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -413,9 +413,8 @@ static inline void iod_init(struct nvme_iod *iod, unsigned nbytes,
 	iod->nents = 0;
 }
 
-static struct nvme_iod *
-__nvme_alloc_iod(unsigned nseg, unsigned bytes, struct nvme_dev *dev,
-		 unsigned long priv, gfp_t gfp)
+struct nvme_iod *nvme_alloc_phys_seg_iod(unsigned nseg, unsigned bytes,
+			struct nvme_dev *dev, unsigned long priv, gfp_t gfp)
 {
 	struct nvme_iod *iod = kmalloc(sizeof(struct nvme_iod) +
 				sizeof(__le64 *) * nvme_npages(bytes, dev) +
@@ -446,7 +445,7 @@ static struct nvme_iod *nvme_alloc_iod(struct request *rq, struct nvme_dev *dev,
 		return iod;
 	}
 
-	return __nvme_alloc_iod(rq->nr_phys_segments, size, dev,
+	return nvme_alloc_phys_seg_iod(rq->nr_phys_segments, size, dev,
 				(unsigned long) rq, gfp);
 }
 
@@ -1699,7 +1698,7 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
 	}
 
 	err = -ENOMEM;
-	iod = __nvme_alloc_iod(count, length, dev, 0, GFP_KERNEL);
+	iod = nvme_alloc_phys_seg_iod(count, length, dev, 0, GFP_KERNEL);
 	if (!iod)
 		goto put_pages;
 
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 0adad4a..f67adb6 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -168,6 +168,8 @@ int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid,
 			dma_addr_t dma_addr, u32 *result);
 int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11,
 			dma_addr_t dma_addr, u32 *result);
+struct nvme_iod *nvme_alloc_phys_seg_iod(unsigned nseg, unsigned bytes,
+			struct nvme_dev *dev, unsigned long priv, gfp_t gfp);
 
 struct sg_io_hdr;
 
-- 
1.9.1

  parent reply	other threads:[~2015-04-22 14:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22 14:26 [PATCH v3 0/7] Support for Open-Channel SSDs Matias Bjørling
2015-04-22 14:26 ` [PATCH v3 1/7] bio: Introduce LightNVM payload Matias Bjørling
2015-05-09 16:00   ` Christoph Hellwig
2015-05-11 11:58     ` Matias Bjørling
2015-05-12  7:21       ` Christoph Hellwig
2015-04-22 14:26 ` [PATCH v3 2/7] block: add REQ_NVM_GC for targets gc Matias Bjørling
2015-05-09 16:00   ` Christoph Hellwig
2015-04-22 14:26 ` [PATCH v3 3/7] lightnvm: Support for Open-Channel SSDs Matias Bjørling
2015-04-22 14:26 ` [PATCH v3 4/7] lightnvm: RRPC target Matias Bjørling
2015-04-22 14:26 ` [PATCH v3 5/7] null_blk: LightNVM support Matias Bjørling
2015-04-22 14:26 ` Matias Bjørling [this message]
2015-04-22 14:26 ` [PATCH v3 7/7] nvme: " Matias Bjørling
2015-05-05 18:51   ` Matias Bjorling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429712816-10336-7-git-send-email-m@bjorling.me \
    --to=m@bjorling.me \
    --cc=axboe@fb.com \
    --cc=hch@infradead.org \
    --cc=javier@paletta.io \
    --cc=keith.busch@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).