From: Daniel Gomez <[email protected]> Cap the initial iovec allocation at IOV_MAX instead of sizing it for the whole sg list, which over-allocates for large IO where the number of sg entries exceeds IOV_MAX.
This is preparatory work for chunking dma_blk_cb() at IOV_MAX to batch large IO: once chunked, dbs->iov never holds more than IOV_MAX iovecs. Signed-off-by: Daniel Gomez <[email protected]> --- system/dma-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dma-helpers.c b/system/dma-helpers.c index 9004ad50ae3..d4fd33a3d4c 100644 --- a/system/dma-helpers.c +++ b/system/dma-helpers.c @@ -242,7 +242,7 @@ BlockAIOCB *dma_blk_io( dbs->io_func = io_func; dbs->io_func_opaque = io_func_opaque; dbs->bh = NULL; - qemu_iovec_init(&dbs->iov, sg->nsg); + qemu_iovec_init(&dbs->iov, MIN(sg->nsg, IOV_MAX)); dma_blk_cb(dbs, 0); return &dbs->common; } -- 2.55.0
