Patchwork [1/2] Add no-op aio emulation stub

login
register
mail settings
Submitter Alexander Graf
Date May 12, 2010, 11:36 p.m.
Message ID <1273707388-5213-2-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/52448/
State New
Headers show

Comments

Alexander Graf - May 12, 2010, 11:36 p.m.
We need to be able to do nothing in AIO fashion. Since I suspect this
could be useful for more cases than the non flushing, I figured I'd
create a new function that does everything AIO-like, but doesn't do
anything.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - remove stray define
  - make aio noop handler static
  - remove header define
---
 block.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
Kevin Wolf - May 14, 2010, 1:12 p.m.
Am 13.05.2010 01:36, schrieb Alexander Graf:
> We need to be able to do nothing in AIO fashion. Since I suspect this
> could be useful for more cases than the non flushing, I figured I'd
> create a new function that does everything AIO-like, but doesn't do
> anything.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

This isn't bisectable:

cc1: warnings being treated as errors
block.c:2208: error: 'bdrv_aio_noop_em' defined but not used

Maybe put everything in one patch, it's small enough now. Also, in
qemu-options.hx you could explain what volatile actually means. Below
the line that you change there are some paragraphs that explain the
behaviour for each value.

Other than that the series looks good to me. I'm not sure if Anthony is
already convinced, though. Everyone else seems to agree with the
intention of the series.

Kevin

Patch

diff --git a/block.c b/block.c
index 48305b7..00e9b6b 100644
--- a/block.c
+++ b/block.c
@@ -2196,6 +2196,24 @@  static BlockDriverAIOCB *bdrv_aio_flush_em(BlockDriverState *bs,
     return &acb->common;
 }
 
+static BlockDriverAIOCB *bdrv_aio_noop_em(BlockDriverState *bs,
+        BlockDriverCompletionFunc *cb, void *opaque)
+{
+    BlockDriverAIOCBSync *acb;
+
+    acb = qemu_aio_get(&bdrv_em_aio_pool, bs, cb, opaque);
+    acb->is_write = 1; /* don't bounce in the completion hadler */
+    acb->qiov = NULL;
+    acb->bounce = NULL;
+    acb->ret = 0;
+
+    if (!acb->bh)
+        acb->bh = qemu_bh_new(bdrv_aio_bh_cb, acb);
+
+    qemu_bh_schedule(acb->bh);
+    return &acb->common;
+}
+
 /**************************************************************/
 /* sync block device emulation */