Messages in this thread | | | Date | Sun, 25 Jan 2015 05:40:38 -0800 | From | Christoph Hellwig <> | Subject | Re: [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.
| |