Commit fc41c97a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

nvmet: use bvec_set_page to initialize bvecs

Use the bvec_set_page helper to initialize bvecs.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20230203150634.3199647-7-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3c7ebe95
......@@ -73,13 +73,6 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
return ret;
}
static void nvmet_file_init_bvec(struct bio_vec *bv, struct scatterlist *sg)
{
bv->bv_page = sg_page(sg);
bv->bv_offset = sg->offset;
bv->bv_len = sg->length;
}
static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos,
unsigned long nr_segs, size_t count, int ki_flags)
{
......@@ -146,7 +139,8 @@ static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags)
memset(&req->f.iocb, 0, sizeof(struct kiocb));
for_each_sg(req->sg, sg, req->sg_cnt, i) {
nvmet_file_init_bvec(&req->f.bvec[bv_cnt], sg);
bvec_set_page(&req->f.bvec[bv_cnt], sg_page(sg), sg->length,
sg->offset);
len += req->f.bvec[bv_cnt].bv_len;
total_len += req->f.bvec[bv_cnt].bv_len;
bv_cnt++;
......
......@@ -321,9 +321,8 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd)
while (length) {
u32 iov_len = min_t(u32, length, sg->length - sg_offset);
iov->bv_page = sg_page(sg);
iov->bv_len = sg->length;
iov->bv_offset = sg->offset + sg_offset;
bvec_set_page(iov, sg_page(sg), sg->length,
sg->offset + sg_offset);
length -= iov_len;
sg = sg_next(sg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment