From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAkp8-0003no-IV for qemu-devel@nongnu.org; Tue, 04 Feb 2014 13:34:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAifh-0007pb-5U for qemu-devel@nongnu.org; Tue, 04 Feb 2014 11:20:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAifg-0007pX-R6 for qemu-devel@nongnu.org; Tue, 04 Feb 2014 11:16:25 -0500 Date: Tue, 4 Feb 2014 17:15:23 +0100 From: Kevin Wolf Message-ID: <20140204161523.GQ3384@dhcp-200-207.str.redhat.com> References: <1391094138-26798-1-git-send-email-olaf@aepfle.de> <20140203154908.GO3643@dhcp-200-207.str.redhat.com> <20140204154737.GA19903@aepfle.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140204154737.GA19903@aepfle.de> Subject: Re: [Qemu-devel] [PATCH] xen_disk: add discard support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Olaf Hering Cc: qemu-devel@nongnu.org, stefanha@redhat.com, stefano.stabellini@eu.citrix.com Am 04.02.2014 um 16:47 hat Olaf Hering geschrieben: > On Mon, Feb 03, Kevin Wolf wrote: > > > Am 30.01.2014 um 16:02 hat Olaf Hering geschrieben: > > > +++ b/hw/block/xen_disk.c > > > > + case BLKIF_OP_DISCARD: > > > + { > > > + struct blkif_request_discard *discard_req = (void *)&ioreq->req; > > > + bdrv_acct_start(blkdev->bs, &ioreq->acct, > > > + discard_req->nr_sectors * BLOCK_SIZE, BDRV_ACCT_WRITE); > > > > Neither SCSI nor IDE account for discards. I think we should keep the > > behaviour consistent across devices. > > Stefano,did you already put this change into your queue? > I will resubmit the patch with the change below. > > Olaf > > > diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c > index e74efc7..69ecc98 100644 > --- a/hw/block/xen_disk.c > +++ b/hw/block/xen_disk.c > @@ -527,8 +527,6 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq) > case BLKIF_OP_DISCARD: > { > struct blkif_request_discard *discard_req = (void *)&ioreq->req; > - bdrv_acct_start(blkdev->bs, &ioreq->acct, > - discard_req->nr_sectors * BLOCK_SIZE, BDRV_ACCT_WRITE); > ioreq->aio_inflight++; > bdrv_aio_discard(blkdev->bs, > discard_req->sector_number, discard_req->nr_sectors, Now you call bdrv_acct_done() in the callback without having a matching bdrv_acct_start(). You need to make it conditional in the callback. Kevin