From: Olaf Hering <olaf@aepfle.de>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com,
stefano.stabellini@eu.citrix.com
Subject: Re: [Qemu-devel] [PATCH] xen_disk: add discard support
Date: Tue, 4 Feb 2014 17:58:19 +0100 [thread overview]
Message-ID: <20140204165819.GA28066@aepfle.de> (raw)
In-Reply-To: <20140204165115.GA27169@aepfle.de>
On Tue, Feb 04, Olaf Hering wrote:
> On Tue, Feb 04, Kevin Wolf wrote:
>
> > 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.
> Stefano,
> Is ioreq_runio_qemu_aio symetric in this regard anyway? In case of
> BLKIF_OP_WRITE|BLKIF_OP_FLUSH_DISKCACHE and no ioreq->req.nr_segments
> then qemu_aio_complete is called anyway. Will qemu_aio_complete get down
> to the bdrv_acct_done call at all in this case?
What I have in mind is something like the (not compile tested) change below.
Olaf
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index e74efc7..99d36b8 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -486,7 +486,16 @@ static void qemu_aio_complete(void *opaque, int ret)
ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
ioreq_unmap(ioreq);
ioreq_finish(ioreq);
- bdrv_acct_done(ioreq->blkdev->bs, &ioreq->acct);
+ switch (ioreq->req.operation) {
+ case BLKIF_OP_DISCARD:
+ break;
+ case BLKIF_OP_WRITE:
+ case BLKIF_OP_FLUSH_DISKCACHE:
+ if (!ioreq->req.nr_segments) {
+ break;
+ }
+ bdrv_acct_done(ioreq->blkdev->bs, &ioreq->acct);
+ }
qemu_bh_schedule(ioreq->blkdev->bh);
}
next prev parent reply other threads:[~2014-02-04 18:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-30 15:02 [Qemu-devel] [PATCH] xen_disk: add discard support Olaf Hering
2014-01-30 15:22 ` Stefano Stabellini
2014-02-03 15:49 ` Kevin Wolf
2014-02-03 16:03 ` Olaf Hering
2014-02-03 16:21 ` Kevin Wolf
2014-02-03 16:12 ` Paolo Bonzini
2014-02-04 15:47 ` Olaf Hering
2014-02-04 15:49 ` Stefano Stabellini
2014-02-04 16:15 ` Kevin Wolf
2014-02-04 16:51 ` Olaf Hering
2014-02-04 16:58 ` Olaf Hering [this message]
2014-02-05 18:07 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140204165819.GA28066@aepfle.de \
--to=olaf@aepfle.de \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=stefano.stabellini@eu.citrix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).