From patchwork Fri Oct 19 13:32:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 192717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2E0EA2C008E for ; Sat, 20 Oct 2012 01:21:50 +1100 (EST) Received: from localhost ([::1]:41132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPCj2-0008Ag-ES for incoming@patchwork.ozlabs.org; Fri, 19 Oct 2012 09:34:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPCip-0007pr-0f for qemu-devel@nongnu.org; Fri, 19 Oct 2012 09:34:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TPCin-0006nz-Va for qemu-devel@nongnu.org; Fri, 19 Oct 2012 09:34:42 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:59837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPCin-0005yp-Pm for qemu-devel@nongnu.org; Fri, 19 Oct 2012 09:34:41 -0400 Received: by mail-pa0-f45.google.com with SMTP id fb10so369528pad.4 for ; Fri, 19 Oct 2012 06:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=U/9wjOfFlEzSYgyE2FfIi/cgi6oUD4l1HdDmYBXbqFY=; b=z1+S9TQq1Z6rW7pU25VseeUGVtd+LB5VbRBHpnatU2rDDq77KP81su9DMbusIxJOfm VWRoICrnlNmxBWQOXDV6xms36Ovm5Nq/UGtLf91PYLDq1kak9VpyfS3Gbs6TrzuB9sQR OFPZh1YOggMI7d7jW3YpqRwvh5gWwRbQrQcYUQ3FwIKUGSBblfLMQ5QEbHwOXVWW1wOH /YM8jzdoLMYW81urtq/BeLxsGN6VDJY5rnI7vqSDjEICsZVT163Ob4x9nzgQlQLL1J5F hsPiVkra3SBAXgoPSXTsFEXUCK9U+QeVM6wgupVZ9fYJZmNz4Kmr3ocyZxwqJdRlRMqJ yNuw== Received: by 10.66.87.105 with SMTP id w9mr4107086paz.5.1350653681393; Fri, 19 Oct 2012 06:34:41 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id kr4sm1240726pbc.76.2012.10.19.06.34.38 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Oct 2012 06:34:40 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 19 Oct 2012 15:32:06 +0200 Message-Id: <1350653528-5834-28-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1350653528-5834-1-git-send-email-pbonzini@redhat.com> References: <1350653528-5834-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.220.45 Subject: [Qemu-devel] [PATCH 27/29] block: prepare code for adding block notifiers 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 There is no reason in principle to skip job cancellation and draining of pending I/O when there is no medium in the disk. Do these unconditionally, which also prepares the code for the next patch. Signed-off-by: Paolo Bonzini --- block.c | 10 +++++----- 1 file modificato, 5 inserzioni(+), 5 rimozioni(-) diff --git a/block.c b/block.c index e95f613..2e4ddea 100644 --- a/block.c +++ b/block.c @@ -1098,12 +1098,12 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state) void bdrv_close(BlockDriverState *bs) { bdrv_flush(bs); - if (bs->drv) { - if (bs->job) { - block_job_cancel_sync(bs->job); - } - bdrv_drain_all(); + if (bs->job) { + block_job_cancel_sync(bs->job); + } + bdrv_drain_all(); + if (bs->drv) { if (bs == bs_snapshots) { bs_snapshots = NULL; }