ide: stash aiocb for flushes

This ensures that operations are completed after a reset

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Paolo Bonzini 2014-08-04 17:11:05 -04:00 committed by Stefan Hajnoczi
parent 14a92e5fe1
commit 69f72a2221

View File

@ -831,6 +831,8 @@ static void ide_flush_cb(void *opaque, int ret)
{ {
IDEState *s = opaque; IDEState *s = opaque;
s->pio_aiocb = NULL;
if (ret < 0) { if (ret < 0) {
/* XXX: What sector number to set here? */ /* XXX: What sector number to set here? */
if (ide_handle_rw_error(s, -ret, BM_STATUS_RETRY_FLUSH)) { if (ide_handle_rw_error(s, -ret, BM_STATUS_RETRY_FLUSH)) {
@ -853,7 +855,7 @@ void ide_flush_cache(IDEState *s)
s->status |= BUSY_STAT; s->status |= BUSY_STAT;
bdrv_acct_start(s->bs, &s->acct, 0, BDRV_ACCT_FLUSH); bdrv_acct_start(s->bs, &s->acct, 0, BDRV_ACCT_FLUSH);
bdrv_aio_flush(s->bs, ide_flush_cb, s); s->pio_aiocb = bdrv_aio_flush(s->bs, ide_flush_cb, s);
} }
static void ide_cfata_metadata_inquiry(IDEState *s) static void ide_cfata_metadata_inquiry(IDEState *s)