From b77912a77a613451e9aac9a12f721eb5e9f09185 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 19 Apr 2012 10:05:04 +0200 Subject: [PATCH] scsi: move scsi_flush_complete around Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 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,6 +153,27 @@ static void scsi_disk_load_request(QEMUFile *f, SCSIRequest *req) qemu_iovec_init_external(&r->qiov, &r->iov, 1); } +static void scsi_flush_complete(void * opaque, int ret) +{ + SCSIDiskReq *r = (SCSIDiskReq *)opaque; + SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); + + bdrv_acct_done(s->qdev.conf.bs, &r->acct); + + if (ret < 0) { + if (scsi_handle_rw_error(r, -ret)) { + goto done; + } + } + + scsi_req_complete(&r->req, GOOD); + +done: + if (!r->req.io_canceled) { + scsi_req_unref(&r->req); + } +} + static void scsi_dma_complete(void *opaque, int ret) { SCSIDiskReq *r = (SCSIDiskReq *)opaque; @@ -206,27 +227,6 @@ done: } } -static void scsi_flush_complete(void * opaque, int ret) -{ - SCSIDiskReq *r = (SCSIDiskReq *)opaque; - SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); - - bdrv_acct_done(s->qdev.conf.bs, &r->acct); - - if (ret < 0) { - if (scsi_handle_rw_error(r, -ret)) { - goto done; - } - } - - scsi_req_complete(&r->req, GOOD); - -done: - if (!r->req.io_canceled) { - scsi_req_unref(&r->req); - } -} - /* Read more data from scsi device into buffer. */ static void scsi_read_data(SCSIRequest *req) {