From 6c5a42ac344306bb3711140a3267c61276c1567b Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 27 Oct 2014 10:18:46 +0100 Subject: block: avoid creating oversized writes in multiwrite_merge Signed-off-by: Peter Lieven Reviewed-by: Ronnie Sahlberg Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi --- block.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'block.c') diff --git a/block.c b/block.c index 76fcc1d6d3..41793419d8 100644 --- a/block.c +++ b/block.c @@ -4446,6 +4446,11 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs, merge = 0; } + if (bs->bl.max_transfer_length && reqs[outidx].nb_sectors + + reqs[i].nb_sectors > bs->bl.max_transfer_length) { + merge = 0; + } + if (merge) { size_t size; QEMUIOVector *qiov = g_malloc0(sizeof(*qiov)); -- cgit v1.2.3