The commit is pushed to "branch-rh9-5.14.0-427.37.1.vz9.78.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh9-5.14.0-427.37.1.vz9.78.4 ------> commit cba0add0f717ea561a7e251f9aff94c42702173b Author: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Date: Wed Nov 6 17:20:31 2024 +0800
vhost-blk: fix allocation size for bio pointers Even pages with continious virtual addresses may not be merged in one bio vector in bio_add_page -> bvec_try_merge_page. So it looks like the best estimate on the number of required bios we can make is a total number of pages in the request divided by BIO_MAX_VECS (worst case is when each of BIO_MAX_VECS bio vectors has exactly one page added to it). Fixes: 17bfe6e0400da ("drivers/vhost: vhost-blk accelerator for virtio-blk guests") https://virtuozzo.atlassian.net/browse/VSTOR-94596 Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Feature: vhost-blk: in-kernel accelerator for virtio-blk guests --- drivers/vhost/blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c index d77e5fc494de..90d20d0eb722 100644 --- a/drivers/vhost/blk.c +++ b/drivers/vhost/blk.c @@ -228,7 +228,7 @@ static struct page **vhost_blk_prepare_req(struct vhost_blk_req *req, req->use_inline = false; pl_len = iov_nr * sizeof(req->pl[0]); page_len = total_pages * sizeof(struct page *); - bio_len = (total_pages / (UINT_MAX / PAGE_SIZE) + 1) * sizeof(struct bio *); + bio_len = (total_pages + BIO_MAX_VECS - 1) / BIO_MAX_VECS * sizeof(struct bio *); buf = kmalloc(pl_len + page_len + bio_len, GFP_KERNEL); if (!buf) _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel