From: Kanchan Joshi <joshi.k@samsung.com>
To: hch@lst.de, kbusch@kernel.org, axboe@kernel.dk
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
joshiiitr@gmail.com
Subject: [PATCH 1/2] block: introduce and export blk_rq_map_user_vec
Date: Thu, 27 Jan 2022 13:55:35 +0530 [thread overview]
Message-ID: <20220127082536.7243-2-joshi.k@samsung.com> (raw)
In-Reply-To: <20220127082536.7243-1-joshi.k@samsung.com>
Similiar to blk_rq_map_user except that it operates on iovec.
This is a prep patch.
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
block/blk-map.c | 19 +++++++++++++++++++
include/linux/blk-mq.h | 2 ++
2 files changed, 21 insertions(+)
diff --git a/block/blk-map.c b/block/blk-map.c
index 4526adde0156..7fe45df3e580 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -577,6 +577,25 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
}
EXPORT_SYMBOL(blk_rq_map_user);
+int blk_rq_map_user_vec(struct request_queue *q, struct request *rq,
+ struct rq_map_data *map_data, void __user *uvec,
+ unsigned long nr_vecs, gfp_t gfp_mask)
+{
+ struct iovec fast_iov[UIO_FASTIOV];
+ struct iovec *iov = fast_iov;
+ struct iov_iter iter;
+ int ret;
+
+ ret = import_iovec(rq_data_dir(rq), uvec, nr_vecs, UIO_FASTIOV, &iov, &iter);
+ if (unlikely(ret < 0))
+ return ret;
+ ret = blk_rq_map_user_iov(q, rq, NULL, &iter, gfp_mask);
+ kfree(iov);
+
+ return ret;
+}
+EXPORT_SYMBOL(blk_rq_map_user_vec);
+
/**
* blk_rq_unmap_user - unmap a request with user data
* @bio: start of bio list
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index d319ffa59354..0fda666d2230 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -966,6 +966,8 @@ struct rq_map_data {
int blk_rq_map_user(struct request_queue *, struct request *,
struct rq_map_data *, void __user *, unsigned long, gfp_t);
+int blk_rq_map_user_vec(struct request_queue *, struct request *,
+ struct rq_map_data *, void __user *, unsigned long, gfp_t);
int blk_rq_map_user_iov(struct request_queue *, struct request *,
struct rq_map_data *, const struct iov_iter *, gfp_t);
int blk_rq_unmap_user(struct bio *);
--
2.25.1
next prev parent reply other threads:[~2022-01-27 9:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220127083033epcas5p3ce9565e4b5e21e897571e48e73e4f9af@epcas5p3.samsung.com>
2022-01-27 8:25 ` [PATCH 0/2] nvme-passthru with vectored-io Kanchan Joshi
2022-01-27 8:25 ` Kanchan Joshi [this message]
2022-01-27 9:27 ` [PATCH 1/2] block: introduce and export blk_rq_map_user_vec Christoph Hellwig
2022-01-27 14:38 ` Kanchan Joshi
2022-01-28 9:04 ` Chaitanya Kulkarni
2022-01-27 8:25 ` [PATCH 2/2] nvme: add vectored-io support for user passthru Kanchan Joshi
2022-01-27 9:29 ` Christoph Hellwig
2022-01-27 14:43 ` Kanchan Joshi
2022-01-28 9:08 ` Chaitanya Kulkarni
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=20220127082536.7243-2-joshi.k@samsung.com \
--to=joshi.k@samsung.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=joshiiitr@gmail.com \
--cc=kbusch@kernel.org \
--cc=linux-block@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).