summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorPeter Lieven <pl@kamp.de>2014-10-27 10:18:46 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-11-03 09:48:41 +0000
commit6c5a42ac344306bb3711140a3267c61276c1567b (patch)
treee1460a5f23274d81ed881000d2603a2dd0377d8a /block.c
parent52f6fa1430209125d1c13fec7d6bbb501aedf322 (diff)
downloadqemu-6c5a42ac344306bb3711140a3267c61276c1567b.tar.gz
qemu-6c5a42ac344306bb3711140a3267c61276c1567b.tar.bz2
qemu-6c5a42ac344306bb3711140a3267c61276c1567b.zip
block: avoid creating oversized writes in multiwrite_merge
Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c5
1 files changed, 5 insertions, 0 deletions
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));