diff mbox

[15/60] block: loop: comment on direct access to bvec table

Message ID 1477728600-12938-16-git-send-email-tom.leiming@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ming Lei Oct. 29, 2016, 8:08 a.m. UTC
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/block/loop.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Christoph Hellwig Oct. 31, 2016, 3:31 p.m. UTC | #1
Btw, the lib/iov_iter.c code that iterates over bvec currently
expects single-page segments.  Is the loop code fine with that?
Even if it is I think we'd be much better off if it becomes multipage
segment aware.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ming Lei Oct. 31, 2016, 11:08 p.m. UTC | #2
On Mon, Oct 31, 2016 at 11:31 PM, Christoph Hellwig <hch@infradead.org> wrote:
> Btw, the lib/iov_iter.c code that iterates over bvec currently
> expects single-page segments.  Is the loop code fine with that?

lib/iov_iter.c has switched to bvec iterator already in the mp-bvec
preparing patchset, so every thing will be fine after multipage bvec
is enabled.

Another multipage bvec benefit for lib/iov_iter.c(dio) is that we
can return whole pages in one segment, instead of one page
each time, such as iov_iter_get_pages(), but that can be
a follow-up optimization.

> Even if it is I think we'd be much better off if it becomes multipage
> segment aware.

This patch is for auditing possible effect with multipage bvec, so
looks we should expose as much as possible direct access to
bvec table.

Thanks,
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index fa1b7a90ba11..55ce4226590d 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -485,6 +485,11 @@  static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd,
 	/* nomerge for loop request queue */
 	WARN_ON(cmd->rq->bio != cmd->rq->biotail);
 
+	/*
+	 * For multipage bvec support, it is safe to pass the bvec
+	 * table to iov iterator, because iov iter still uses bvec
+	 * iter helpers to travese bvec.
+	 */
 	bvec = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter);
 	iov_iter_bvec(&iter, ITER_BVEC | rw, bvec,
 		      bio_segments(bio), blk_rq_bytes(cmd->rq));