From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34171 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFOi8-0002F1-JF for qemu-devel@nongnu.org; Fri, 21 May 2010 05:40:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFOi7-0006OV-4h for qemu-devel@nongnu.org; Fri, 21 May 2010 05:40:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29793) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFOi6-0006OL-Nd for qemu-devel@nongnu.org; Fri, 21 May 2010 05:40:07 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4L9e5rq022123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 May 2010 05:40:06 -0400 From: Kevin Wolf Date: Fri, 21 May 2010 11:39:45 +0200 Message-Id: <1274434785-7352-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] block: Fix multiwrite with overlapping requests List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com With overlapping requests, the total number of sectors is smaller than the sum of the nb_sectors of both requests. Signed-off-by: Kevin Wolf --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index 72d9441..1586b79 100644 --- a/block.c +++ b/block.c @@ -2029,7 +2029,7 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs, // Add the second request qemu_iovec_concat(qiov, reqs[i].qiov, reqs[i].qiov->size); - reqs[outidx].nb_sectors += reqs[i].nb_sectors; + reqs[outidx].nb_sectors = qiov->size >> 9; reqs[outidx].qiov = qiov; mcb->callbacks[i].free_qiov = reqs[outidx].qiov; -- 1.6.6.1