From c13f81fefa1700cfcc52ddc72985e701a938d2c1 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Paolo Bonzini Date: Mon, 27 Aug 2012 13:42:07 +0200 Subject: [PATCH 04/10] scsi: move scsi_flush_complete around RH-Author: Paolo Bonzini Message-id: <1346074931-12083-4-git-send-email-pbonzini@redhat.com> Patchwork-id: 41330 O-Subject: [RHEL 6.4 qemu-kvm PATCH 3/7] scsi: move scsi_flush_complete around Bugzilla: 814084 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Markus Armbruster RH-Acked-by: Orit Wasserman Bugzilla: 814084 Just code movement, though the diff seems to say otherwise. Tried many diff options, found no way to make it easier. Signed-off-by: Paolo Bonzini (cherry picked from commit b77912a77a613451e9aac9a12f721eb5e9f09185) --- hw/scsi-disk.c | 36 ++++++++++++++++++------------------ 1 file modificato, 18 inserzioni(+), 18 rimozioni(-) Signed-off-by: Michal Novotny --- hw/scsi-disk.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index f33f359..05ee81a 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -150,7 +150,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); @@ -163,8 +163,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: @@ -173,16 +171,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)) { @@ -190,12 +184,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) { @@ -203,12 +194,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)) { @@ -216,7 +211,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) { -- 1.7.11.4