提交 7f056357 编写于 作者: A Anuj Gupta 提交者: Jens Axboe

nvme: Use blk_rq_map_user_io helper

User blk_rq_map_user_io instead of duplicating the same code at
different places
Signed-off-by: NAnuj Gupta <anuj20.g@samsung.com>
Link: https://lore.kernel.org/r/20220930062749.152261-6-anuj20.g@samsung.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
上级 6732932c
......@@ -88,22 +88,8 @@ static struct request *nvme_alloc_user_request(struct request_queue *q,
nvme_req(req)->flags |= NVME_REQ_USERCMD;
if (ubuffer && bufflen) {
if (!vec)
ret = blk_rq_map_user(q, req, NULL, ubuffer, bufflen,
GFP_KERNEL);
else {
struct iovec fast_iov[UIO_FASTIOV];
struct iovec *iov = fast_iov;
struct iov_iter iter;
ret = import_iovec(rq_data_dir(req), ubuffer, bufflen,
UIO_FASTIOV, &iov, &iter);
if (ret < 0)
goto out;
ret = blk_rq_map_user_iov(q, req, NULL, &iter,
GFP_KERNEL);
kfree(iov);
}
ret = blk_rq_map_user_io(req, NULL, ubuffer, bufflen,
GFP_KERNEL, vec, 0, 0, rq_data_dir(req));
if (ret)
goto out;
bio = req->bio;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册