diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-04-19 14:00:24 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-04-19 15:27:20 +0200 |
commit | 80624c938d2d9d2b2cca56326876f213c31e1202 (patch) | |
tree | f5c2531ba2994ba2e06e64cd1296b98184511abe /hw | |
parent | b8aba8d7e3031ee3411a8e5eb07ac61f5b18f045 (diff) |
scsi: make code more homogeneous in AIO callback functions
First scsi_flush_complete, like scsi_dma_complete, is always called with
an active AIOCB.
Second, always test for "ret < 0" to check for errors.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/scsi-disk.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 792e9d045a..1664793387 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -160,7 +160,7 @@ static void scsi_dma_complete(void *opaque, int ret) bdrv_acct_done(s->qdev.conf.bs, &r->acct); - if (ret) { + if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; } @@ -187,7 +187,7 @@ static void scsi_read_complete(void * opaque, int ret) bdrv_acct_done(s->qdev.conf.bs, &r->acct); } - if (ret) { + if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; } @@ -211,10 +211,7 @@ static void scsi_flush_complete(void * opaque, int ret) SCSIDiskReq *r = (SCSIDiskReq *)opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); - if (r->req.aiocb != NULL) { - r->req.aiocb = NULL; - bdrv_acct_done(s->qdev.conf.bs, &r->acct); - } + bdrv_acct_done(s->qdev.conf.bs, &r->acct); if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { @@ -335,7 +332,7 @@ static void scsi_write_complete(void * opaque, int ret) bdrv_acct_done(s->qdev.conf.bs, &r->acct); } - if (ret) { + if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; } |