From mboxrd@z Thu Jan 1 00:00:00 1970 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) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 19 Oct 2012 15:32:06 +0200 Message-Id: <1350653528-5834-28-git-send-email-pbonzini@redhat.com> In-Reply-To: <1350653528-5834-1-git-send-email-pbonzini@redhat.com> References: <1350653528-5834-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 27/29] block: prepare code for adding block notifiers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@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; } -- 1.7.12.1