summaryrefslogtreecommitdiff
path: root/hw/ide/core.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-09-04 19:02:06 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-09-11 10:19:46 -0500
commitb0484ae464dcd8ee7439c4257b2f40d6b0e007dd (patch)
treeb63018574755e0a752dc9a6c583be424a7112c31 /hw/ide/core.c
parentb2e12bc6e304c17da0bee970fb4776d0731422e6 (diff)
downloadqemu-b0484ae464dcd8ee7439c4257b2f40d6b0e007dd.tar.gz
ide: use bdrv_aio_flush
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ide/core.c')
-rw-r--r--hw/ide/core.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 6fd6dc2477..87d5cdf6ef 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -771,6 +771,16 @@ static void ide_atapi_cmd_check_status(IDEState *s)
ide_set_irq(s->bus);
}
+static void ide_flush_cb(void *opaque, int ret)
+{
+ IDEState *s = opaque;
+
+ /* XXX: how do we signal I/O errors here? */
+
+ s->status = READY_STAT | SEEK_STAT;
+ ide_set_irq(s->bus);
+}
+
static inline void cpu_to_ube16(uint8_t *buf, int val)
{
buf[0] = val >> 8;
@@ -1969,9 +1979,9 @@ void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
case WIN_FLUSH_CACHE:
case WIN_FLUSH_CACHE_EXT:
if (s->bs)
- bdrv_flush(s->bs);
- s->status = READY_STAT | SEEK_STAT;
- ide_set_irq(s->bus);
+ bdrv_aio_flush(s->bs, ide_flush_cb, s);
+ else
+ ide_flush_cb(s, 0);
break;
case WIN_STANDBY:
case WIN_STANDBY2: