From patchwork Tue May 18 17:18:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [+stable] block: don't attempt to merge overlapping requests Date: Tue, 18 May 2010 07:18:44 -0000 From: Avi Kivity X-Patchwork-Id: 52896 Message-Id: <1274203124-14318-1-git-send-email-avi@redhat.com> To: Kevin Wolf Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org The block multiwrite code pretends to be able to merge overlapping requests, but doesn't do so in fact. This leads to I/O errors (for example on mkfs of a large virtio disk). Signed-off-by: Avi Kivity --- block.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 48305b7..0e44e26 100644 --- a/block.c +++ b/block.c @@ -1956,8 +1956,8 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs, int64_t oldreq_last = reqs[outidx].sector + reqs[outidx].nb_sectors; // This handles the cases that are valid for all block drivers, namely - // exactly sequential writes and overlapping writes. - if (reqs[i].sector <= oldreq_last) { + // exactly sequential writes + if (reqs[i].sector == oldreq_last) { merge = 1; }