From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPvu6-0008UG-BL for qemu-devel@nongnu.org; Mon, 14 Nov 2011 07:44:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPvu4-00049W-4G for qemu-devel@nongnu.org; Mon, 14 Nov 2011 07:44:50 -0500 Received: from mtagate1.uk.ibm.com ([194.196.100.161]:48099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPvu3-00048N-TC for qemu-devel@nongnu.org; Mon, 14 Nov 2011 07:44:48 -0500 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id pAECiiRm010901 for ; Mon, 14 Nov 2011 12:44:44 GMT Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pAECiiBh2514988 for ; Mon, 14 Nov 2011 12:44:44 GMT Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pAECiiMk006239 for ; Mon, 14 Nov 2011 05:44:44 -0700 From: Stefan Hajnoczi Date: Mon, 14 Nov 2011 12:44:17 +0000 Message-Id: <1321274666-14041-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2 0/9] block: replace .bdrv_is_allocated() with .bdrv_co_is_allocated() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Marcelo Tosatti , Stefan Hajnoczi The bdrv_is_allocated() interface is not suitable for use while the VM is running. It is a synchronous interface so it may block the running VM for arbitrary amounts of time. It also assumes it is the only block driver operation and there is a risk that internal state could be corrupted if asynchronous I/O is currently pending. This patch series refactors the block layer so that the bdrv_is_allocated() operation is performed internally in coroutine context. We can then introduce a new public bdrv_co_is_allocated() function that is suitable for use when the VM is running. Making these changes without breaking git bisect means we need to first introduce BlockDriver .bdrv_co_is_allocated() and add wrapper code into bdrv_is_allocated() so existing callers can use converted BlockDrivers. After converting all block drivers there are no .bdrv_is_allocated() functions left and the interface can be removed from BlockDriver. Finally, we can add the new public bdrv_co_is_allocated() public interface and turn the old bdrv_is_allocated() into a wrapper. This series is a prerequisite for copy-on-read, which needs to check whether sectors are allocated while the VM is running. v2: * Rebased on kevin/block and resolved conflicts Stefan Hajnoczi (9): block: use public bdrv_is_allocated() interface block: add .bdrv_co_is_allocated() qed: convert to .bdrv_co_is_allocated() block: convert qcow2, qcow2, and vmdk to .bdrv_co_is_allocated() vvfat: convert to .bdrv_co_is_allocated() vdi: convert to .bdrv_co_is_allocated() cow: convert to .bdrv_co_is_allocated() block: drop .bdrv_is_allocated() interface block: add bdrv_co_is_allocated() interface block.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++----- block.h | 2 + block/cow.c | 8 +++--- block/qcow.c | 8 ++++-- block/qcow2.c | 13 +++++++---- block/qed.c | 15 ++++++++++--- block/vdi.c | 6 ++-- block/vmdk.c | 8 ++++-- block/vvfat.c | 4 +- block_int.h | 4 +- 10 files changed, 94 insertions(+), 32 deletions(-) -- 1.7.7.1