From patchwork Fri May 14 09:51:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MORITA Kazutaka X-Patchwork-Id: 99567 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4E9aAhs001944 for ; Fri, 14 May 2010 09:36:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756062Ab0ENJgH (ORCPT ); Fri, 14 May 2010 05:36:07 -0400 Received: from sh.osrg.net ([192.16.179.4]:33317 "EHLO sh.osrg.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870Ab0ENJgF (ORCPT ); Fri, 14 May 2010 05:36:05 -0400 Received: from fs.osrg.net (postfix@fs.osrg.net [10.0.0.12]) by sh.osrg.net (8.14.3/8.14.3/OSRG-NET) with ESMTP id o4E9Z95h006521; Fri, 14 May 2010 18:35:09 +0900 Received: from localhost (dfs1401.osrg.net [10.68.14.1]) by fs.osrg.net (Postfix) with ESMTP id 055153E02EF; Fri, 14 May 2010 18:35:09 +0900 (JST) From: MORITA Kazutaka To: avi@redhat.com, aliguori@us.ibm.com, kwolf@redhat.com, hch@lst.de Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, sheepdog@lists.wpkg.org, fujita.tomonori@lab.ntt.co.jp Subject: [RFC PATCH v2 1/3] close all the block drivers before the qemu process exits Date: Fri, 14 May 2010 18:51:14 +0900 Message-Id: <1273830676-2349-2-git-send-email-morita.kazutaka@lab.ntt.co.jp> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1273661213-19611-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> References: <1273661213-19611-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> X-Dispatcher: imput version 20070423(IM149) Lines: 60 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 14 May 2010 09:36:10 +0000 (UTC) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (sh.osrg.net [192.16.179.4]); Fri, 14 May 2010 18:35:11 +0900 (JST) X-Virus-Scanned: clamav-milter 0.96 at sh X-Virus-Status: Clean Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/block.c b/block.c index c134c2b..988a94a 100644 --- a/block.c +++ b/block.c @@ -641,6 +641,15 @@ void bdrv_close(BlockDriverState *bs) } } +void bdrv_close_all(void) +{ + BlockDriverState *bs; + + QTAILQ_FOREACH(bs, &bdrv_states, list) { + bdrv_close(bs); + } +} + void bdrv_delete(BlockDriverState *bs) { /* remove from list, if necessary */ diff --git a/block.h b/block.h index 278259c..531e802 100644 --- a/block.h +++ b/block.h @@ -121,6 +121,7 @@ BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, /* Ensure contents are flushed to disk. */ void bdrv_flush(BlockDriverState *bs); void bdrv_flush_all(void); +void bdrv_close_all(void); int bdrv_has_zero_init(BlockDriverState *bs); int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, diff --git a/vl.c b/vl.c index 85bcc84..5ce7807 100644 --- a/vl.c +++ b/vl.c @@ -2007,6 +2007,7 @@ static void main_loop(void) exit(0); } } + bdrv_close_all(); pause_all_vcpus(); }