From: "Matias Bjørling" <m@bjorling.me>
To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Matias Bjørling" <m@bjorling.me>
Subject: [PATCH RFC 4/5] lightnvm: introduce nvm_submit_ppa
Date: Mon, 14 Dec 2015 14:17:06 +0100 [thread overview]
Message-ID: <1450099027-24745-5-git-send-email-m@bjorling.me> (raw)
In-Reply-To: <1450099027-24745-1-git-send-email-m@bjorling.me>
Internal logic for both core and media managers, does not have a
backing bio for issuing I/Os. Introduce nvm_submit_ppa to allow raw
I/Os to be submitted to the underlying device driver.
The function request the device, ppa, data buffer and its length and
will submit the I/O synchronously to the device. The return value may
therefore be used to detect any errors regarding the issued I/O.
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
drivers/lightnvm/core.c | 31 +++++++++++++++++++++++++++++++
include/linux/lightnvm.h | 1 +
2 files changed, 32 insertions(+)
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 081b0f5..77a9907 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -288,6 +288,37 @@ int nvm_erase_ppa(struct nvm_dev *dev, struct ppa_addr ppa)
}
EXPORT_SYMBOL(nvm_erase_ppa);
+int nvm_submit_ppa(struct nvm_dev *dev, struct ppa_addr ppa, int opcode,
+ void *buf, int len)
+{
+ struct nvm_rq rqd;
+ struct bio *bio;
+ int ret;
+
+ bio = bio_map_kern(dev->q, buf, len, GFP_KERNEL);
+ if (IS_ERR_OR_NULL(bio))
+ return -ENOMEM;
+
+ memset(&rqd, 0, sizeof(struct nvm_rq));
+ ret = nvm_set_rqd_ppalist(dev, &rqd, &ppa, 1);
+ if (ret) {
+ bio_put(bio);
+ return ret;
+ }
+
+ rqd.opcode = opcode;
+ rqd.flags = NVM_IO_F_SYNC;
+ rqd.bio = bio;
+ nvm_generic_to_addr_mode(dev, &rqd);
+
+ ret = dev->ops->submit_io(dev, &rqd);
+
+ nvm_free_rqd_ppalist(dev, &rqd);
+
+ return ret;
+}
+EXPORT_SYMBOL(nvm_submit_ppa);
+
static int nvm_core_init(struct nvm_dev *dev)
{
struct nvm_id *id = &dev->identity;
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index 770278a..0017d55 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -437,6 +437,7 @@ extern int nvm_set_rqd_ppalist(struct nvm_dev *, struct nvm_rq *,
extern void nvm_free_rqd_ppalist(struct nvm_dev *, struct nvm_rq *);
extern int nvm_erase_ppa(struct nvm_dev *, struct ppa_addr);
extern int nvm_erase_blk(struct nvm_dev *, struct nvm_block *);
+extern int nvm_submit_ppa(struct nvm_dev *, struct ppa_addr, int, void *, int);
#else /* CONFIG_NVM */
struct nvm_dev_ops;
--
2.1.4
next prev parent reply other threads:[~2015-12-14 13:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 13:17 [PATCH RFC 0/5] lightnvm: Introduce System Blocks Matias Bjørling
2015-12-14 13:17 ` [PATCH RFC 1/5] lightnvm: move ppa erase logic to core Matias Bjørling
2015-12-14 13:17 ` [PATCH RFC 2/5] lightnvm: refactor rqd ppa list into set/free Matias Bjørling
2015-12-14 13:17 ` [PATCH RFC 3/5] lightnvm: add sync support for submit_io Matias Bjørling
2015-12-15 12:34 ` Christoph Hellwig
2015-12-15 14:10 ` Matias Bjørling
2015-12-14 13:17 ` Matias Bjørling [this message]
2015-12-14 13:17 ` [PATCH RFC 5/5] lightnvm: core on-disk initialization Matias Bjørling
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=1450099027-24745-5-git-send-email-m@bjorling.me \
--to=m@bjorling.me \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®