diff options
author | Sagi Grimberg <sagi@grimberg.me> | 2021-01-14 13:15:26 -0800 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2021-02-02 10:26:11 +0100 |
commit | 0dc9edaf80ea3c48231d94cd482355699d453888 (patch) | |
tree | bdb92c34a0ea01858327ab74be5c7b8da4dc6100 /drivers/nvme | |
parent | 60141aa08c08a43f3d22626b3a2532106a90a191 (diff) | |
download | linux-stable-0dc9edaf80ea3c48231d94cd482355699d453888.tar.gz linux-stable-0dc9edaf80ea3c48231d94cd482355699d453888.tar.bz2 linux-stable-0dc9edaf80ea3c48231d94cd482355699d453888.zip |
nvme-tcp: pass multipage bvec to request iov_iter
iov_iter uses the right helpers so we should be able
to pass in a multipage bvec. Right now the iov_iter is
initialized with more segments that it needs which doesn't
fail because the iov_iter is capped by byte count, but it
is better to use a full multipage bvec iter.
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/tcp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index f2f3471faed3..4c13c7110dbe 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -224,24 +224,29 @@ static void nvme_tcp_init_iter(struct nvme_tcp_request *req, struct request *rq = blk_mq_rq_from_pdu(req); struct bio_vec *vec; unsigned int size; - int nsegs; + int nr_bvec; size_t offset; if (rq->rq_flags & RQF_SPECIAL_PAYLOAD) { vec = &rq->special_vec; - nsegs = 1; + nr_bvec = 1; size = blk_rq_payload_bytes(rq); offset = 0; } else { struct bio *bio = req->curr_bio; + struct bvec_iter bi; + struct bio_vec bv; vec = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter); - nsegs = bio_segments(bio); + nr_bvec = 0; + bio_for_each_bvec(bv, bio, bi) { + nr_bvec++; + } size = bio->bi_iter.bi_size; offset = bio->bi_iter.bi_bvec_done; } - iov_iter_bvec(&req->iter, dir, vec, nsegs, size); + iov_iter_bvec(&req->iter, dir, vec, nr_bvec, size); req->iter.iov_offset = offset; } |