Re: [PATCH v2 4/4] block: loop: support to submit I/O via kernel aio based

From: Christoph Hellwig
Date: Sun Jan 25 2015 - 08:41:13 EST


> +{
> + 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/