From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrZXx-0006jC-WF for qemu-devel@nongnu.org; Wed, 18 Jul 2012 15:04:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrZXs-0004pC-IC for qemu-devel@nongnu.org; Wed, 18 Jul 2012 15:04:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrZXs-0004p5-8Y for qemu-devel@nongnu.org; Wed, 18 Jul 2012 15:04:24 -0400 Date: Wed, 18 Jul 2012 22:04:45 +0300 From: "Michael S. Tsirkin" Message-ID: <20120718190445.GE2498@redhat.com> References: <1342624074-24650-1-git-send-email-stefanha@linux.vnet.ibm.com> <1342624074-24650-23-git-send-email-stefanha@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1342624074-24650-23-git-send-email-stefanha@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC v9 22/27] virtio-blk: Fix request merging List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , kvm@vger.kernel.org, qemu-devel@nongnu.org, Khoa Huynh , Paolo Bonzini , Asias He On Wed, Jul 18, 2012 at 04:07:49PM +0100, Stefan Hajnoczi wrote: > Khoa Huynh discovered that request merging is broken. > The merged iocb is not updated to reflect the total number of iovecs and > the offset is also outdated. > > This patch fixes request merging. > > Signed-off-by: Stefan Hajnoczi So all these fixups need to be folded in making it correct first time. > --- > hw/virtio-blk.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c > index 9131a7a..51807b5 100644 > --- a/hw/virtio-blk.c > +++ b/hw/virtio-blk.c > @@ -178,13 +178,17 @@ static void merge_request(struct iocb *iocb_a, struct iocb *iocb_b) > req_a->len = iocb_nbytes(iocb_a); > } > > - iocb_b->u.v.vec = iovec; > - req_b->len = iocb_nbytes(iocb_b); > - req_b->next_merged = req_a; > /* > fprintf(stderr, "merged %p (%u) and %p (%u), %u iovecs in total\n", > req_a, iocb_a->u.v.nr, req_b, iocb_b->u.v.nr, iocb_a->u.v.nr + iocb_b->u.v.nr); > */ > + > + iocb_b->u.v.vec = iovec; > + iocb_b->u.v.nr += iocb_a->u.v.nr; > + iocb_b->u.v.offset = iocb_a->u.v.offset; > + > + req_b->len = iocb_nbytes(iocb_b); > + req_b->next_merged = req_a; > } > > static void process_request(IOQueue *ioq, struct iovec iov[], unsigned int out_num, unsigned int in_num, unsigned int head) > -- > 1.7.10.4