[Devel] [PATCH VZ9 1/3] vhost-blk: don't allocate biovec for flush

2024-11-06 Thread Pavel Tikhomirov
There is no point in adding even one vector as we don't add any pages to it. E.g. dispatch_rw_block_io(), blkdev_issue_flush() or async_pmem_flush() where zero vectors are used for flush requests. Fixes: 17bfe6e0400da ("drivers/vhost: vhost-blk accelerator for virtio-blk guests") https://virtuozz

[Devel] [PATCH VZ9 0/3] vhost-blk: fix bio allocation crash

2024-11-06 Thread Pavel Tikhomirov
https://virtuozzo.atlassian.net/browse/VSTOR-94596 Pavel Tikhomirov (3): vhost-blk: don't allocate biovec for flush vhost-blk: fix bio allocation failure on excess bio vector count vhost-blk: fix allocation size for bio pointers drivers/vhost/blk.c | 7 --- 1 file changed, 4 insertions

Re: [Devel] [PATCH VZ9 0/3] vhost-blk: fix bio allocation crash

2024-11-06 Thread Pavel Tikhomirov
Please take a look. On 11/6/24 17:20, Pavel Tikhomirov wrote: https://virtuozzo.atlassian.net/browse/VSTOR-94596 Pavel Tikhomirov (3): vhost-blk: don't allocate biovec for flush vhost-blk: fix bio allocation failure on excess bio vector count vhost-blk: fix allocation size for bio poin

[Devel] [PATCH VZ9 3/3] vhost-blk: fix allocation size for bio pointers

2024-11-06 Thread Pavel Tikhomirov
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_MA

[Devel] [PATCH VZ9 2/3] vhost-blk: fix bio allocation failure on excess bio vector count

2024-11-06 Thread Pavel Tikhomirov
The bio_alloc() function does not allow to allocate bio-s with more than BIO_MAX_VECS bio vectors. Currently we give to it the nr_vecs argument equal to the number of pages in all iovecs of the processed request, which can be much bigger than BIO_MAX_VECS (256), this is incorrect and leads to the b