From patchwork Thu Oct 13 11:03:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 119425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 48F28B6F8B for ; Thu, 13 Oct 2011 22:06:02 +1100 (EST) Received: from localhost ([::1]:50105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REJ6r-00089R-NB for incoming@patchwork.ozlabs.org; Thu, 13 Oct 2011 07:05:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]:55392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REJ5q-0006b9-8i for qemu-devel@nongnu.org; Thu, 13 Oct 2011 07:04:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1REJ5p-0004GZ-1S for qemu-devel@nongnu.org; Thu, 13 Oct 2011 07:04:54 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:62261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REJ5o-0004GI-TG for qemu-devel@nongnu.org; Thu, 13 Oct 2011 07:04:53 -0400 Received: by wwf10 with SMTP id 10so7744201wwf.4 for ; Thu, 13 Oct 2011 04:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=MkjfzTI9DM97vA9BMZGDv+S/o4XmRFqNnu6LL/oMxSk=; b=kkgwnyJkx/uILBqthGFtYpn3OAeuFUgsTRzz1T8ZHFnDP82XmZj3aygC3cRYhAgTHM alL5WOpG/npeWg0bdLYF1sH6QHKzcF+i/2Xl2JalqMZgWzjyVy7EzbOr91AKvgwlKVZj oT048i8zlTXFTc/YhqnRilbIg0UBzi0IlnXqM= Received: by 10.227.120.205 with SMTP id e13mr556828wbr.98.1318503892201; Thu, 13 Oct 2011 04:04:52 -0700 (PDT) Received: from localhost.localdomain (nat-pool-mxp-t.redhat.com. [209.132.186.18]) by mx.google.com with ESMTPS id g20sm5290288wbp.13.2011.10.13.04.04.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Oct 2011 04:04:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 13 Oct 2011 13:03:52 +0200 Message-Id: <1318503845-11473-23-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1318503845-11473-1-git-send-email-pbonzini@redhat.com> References: <1318503845-11473-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.41 Subject: [Qemu-devel] [PATCH 22/35] scsi-disk: fix retrying a flush X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Flush does not go anymore through scsi_disk_emulate_command. Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 3f54891..860a3bf 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -81,7 +81,7 @@ struct SCSIDiskState }; static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type); -static int scsi_disk_emulate_command(SCSIDiskReq *r); +static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf); static void scsi_free_request(SCSIRequest *req) { @@ -336,7 +336,6 @@ static void scsi_dma_restart_bh(void *opaque) r = DO_UPCAST(SCSIDiskReq, req, req); if (r->status & SCSI_REQ_STATUS_RETRY) { int status = r->status; - int ret; r->status &= ~(SCSI_REQ_STATUS_RETRY | SCSI_REQ_STATUS_RETRY_TYPE_MASK); @@ -349,10 +348,8 @@ static void scsi_dma_restart_bh(void *opaque) scsi_write_data(&r->req); break; case SCSI_REQ_STATUS_RETRY_FLUSH: - ret = scsi_disk_emulate_command(r); - if (ret == 0) { - scsi_req_complete(&r->req, GOOD); - } + scsi_send_command(&r->req, r->req.cmd.buf); + break; } /* This reference was left in by scsi_handle_rw_error. */ scsi_req_unref(&r->req);