[PATCH 1/2] block: introduce and export blk_rq_map_user_vec

Kanchan Joshi joshiiitr at gmail.com
Thu Jan 27 06:38:08 PST 2022


On Thu, Jan 27, 2022 at 2:57 PM Christoph Hellwig <hch at lst.de> wrote:
>
> On Thu, Jan 27, 2022 at 01:55:35PM +0530, Kanchan Joshi wrote:
> > Similiar to blk_rq_map_user except that it operates on iovec.
> > This is a prep patch.
> >
> > Signed-off-by: Kanchan Joshi <joshi.k at samsung.com>
> > Signed-off-by: Anuj Gupta <anuj20.g at 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;
>
> I see very little point in adding this function vs just open coding it.

Fine, I will kill this and open-code in nvme instead.


-- 
Kanchan



More information about the Linux-nvme mailing list