rbd: use bvec_set_page to initialize the copy up bvec

Use the bvec_set_page helper to initialize the copy up bvec.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Link: https://lore.kernel.org/r/20230203150634.3199647-9-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2023-02-03 16:06:19 +01:00 committed by Jens Axboe
parent 4bee16daf1
commit 7df2af0bb4
1 changed files with 3 additions and 4 deletions

View File

@ -3068,13 +3068,12 @@ static int setup_copyup_bvecs(struct rbd_obj_request *obj_req, u64 obj_overlap)
for (i = 0; i < obj_req->copyup_bvec_count; i++) { for (i = 0; i < obj_req->copyup_bvec_count; i++) {
unsigned int len = min(obj_overlap, (u64)PAGE_SIZE); unsigned int len = min(obj_overlap, (u64)PAGE_SIZE);
struct page *page = alloc_page(GFP_NOIO);
obj_req->copyup_bvecs[i].bv_page = alloc_page(GFP_NOIO); if (!page)
if (!obj_req->copyup_bvecs[i].bv_page)
return -ENOMEM; return -ENOMEM;
obj_req->copyup_bvecs[i].bv_offset = 0; bvec_set_page(&obj_req->copyup_bvecs[i], page, len, 0);
obj_req->copyup_bvecs[i].bv_len = len;
obj_overlap -= len; obj_overlap -= len;
} }