aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-disk.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-04-19 10:05:04 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-04-19 15:27:20 +0200
commitb77912a77a613451e9aac9a12f721eb5e9f09185 (patch)
tree61517b94f0345b80ffd323cae11ed19f8164446d /hw/scsi-disk.c
parent80624c938d2d9d2b2cca56326876f213c31e1202 (diff)
scsi: move scsi_flush_complete around
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r--hw/scsi-disk.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 1664793387..158ed5b2fb 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -153,7 +153,7 @@ static void scsi_disk_load_request(QEMUFile *f, SCSIRequest *req)
qemu_iovec_init_external(&r->qiov, &r->iov, 1);
}
-static void scsi_dma_complete(void *opaque, int ret)
+static void scsi_flush_complete(void * opaque, int ret)
{
SCSIDiskReq *r = (SCSIDiskReq *)opaque;
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
@@ -166,8 +166,6 @@ static void scsi_dma_complete(void *opaque, int ret)
}
}
- r->sector += r->sector_count;
- r->sector_count = 0;
scsi_req_complete(&r->req, GOOD);
done:
@@ -176,16 +174,12 @@ done:
}
}
-static void scsi_read_complete(void * opaque, int ret)
+static void scsi_dma_complete(void *opaque, int ret)
{
SCSIDiskReq *r = (SCSIDiskReq *)opaque;
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
- int n;
- 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)) {
@@ -193,12 +187,9 @@ static void scsi_read_complete(void * opaque, int ret)
}
}
- DPRINTF("Data ready tag=0x%x len=%zd\n", r->req.tag, r->qiov.size);
-
- n = r->qiov.size / 512;
- r->sector += n;
- r->sector_count -= n;
- scsi_req_data(&r->req, r->qiov.size);
+ r->sector += r->sector_count;
+ r->sector_count = 0;
+ scsi_req_complete(&r->req, GOOD);
done:
if (!r->req.io_canceled) {
@@ -206,12 +197,16 @@ done:
}
}
-static void scsi_flush_complete(void * opaque, int ret)
+static void scsi_read_complete(void * opaque, int ret)
{
SCSIDiskReq *r = (SCSIDiskReq *)opaque;
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
+ int n;
- bdrv_acct_done(s->qdev.conf.bs, &r->acct);
+ if (r->req.aiocb != NULL) {
+ r->req.aiocb = NULL;
+ bdrv_acct_done(s->qdev.conf.bs, &r->acct);
+ }
if (ret < 0) {
if (scsi_handle_rw_error(r, -ret)) {
@@ -219,7 +214,12 @@ static void scsi_flush_complete(void * opaque, int ret)
}
}
- scsi_req_complete(&r->req, GOOD);
+ DPRINTF("Data ready tag=0x%x len=%zd\n", r->req.tag, r->qiov.size);
+
+ n = r->qiov.size / 512;
+ r->sector += n;
+ r->sector_count -= n;
+ scsi_req_data(&r->req, r->qiov.size);
done:
if (!r->req.io_canceled) {