lkml.org 
[lkml]   [2015]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 4/4] block: loop: support to submit I/O via kernel aio based
> +{
> + unsigned int i = 0;
> + struct iov_iter iter;
> + struct bio_vec *bvec, bv;
> + size_t nr_segs = 0;
> + struct req_iterator r_iter;
> +
> + rq_for_each_segment(bv, cmd->rq, r_iter)
> + nr_segs++;
> +
> + if (nr_segs > LOOP_CMD_BVEC_CNT) {
> + cmd->alloc_bv = kmalloc(nr_segs * sizeof(*cmd->alloc_bv),
> + GFP_NOIO);
> + if (!cmd->alloc_bv)
> + return -ENOMEM;
> + bvec = cmd->alloc_bv;
> + } else {
> + bvec = cmd->bv;
> + cmd->alloc_bv = NULL;
> + }
> +
> + rq_for_each_segment(bv, cmd->rq, r_iter)
> + bvec[i++] = bv;

What prevents us from simplify using the bvecs in the request? Sure
we'd need to disable merging for this case, but it would avoid the
copy, and the potentival memory allocation.


\
 
 \ /
  Last update: 2015-01-25 15:01    [W:0.142 / U:4.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site