From patchwork Tue Jan 12 12:49:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 42723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C75B61007D2 for ; Tue, 12 Jan 2010 23:56:13 +1100 (EST) Received: from localhost ([127.0.0.1]:56407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUgEg-0000Xa-7h for incoming@patchwork.ozlabs.org; Tue, 12 Jan 2010 07:52:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NUgBz-00009M-IK for qemu-devel@nongnu.org; Tue, 12 Jan 2010 07:49:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NUgBu-000057-KO for qemu-devel@nongnu.org; Tue, 12 Jan 2010 07:49:50 -0500 Received: from [199.232.76.173] (port=33994 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUgBu-00004u-9t for qemu-devel@nongnu.org; Tue, 12 Jan 2010 07:49:46 -0500 Received: from verein.lst.de ([213.95.11.210]:32991) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1NUgBt-0001TJ-FZ for qemu-devel@nongnu.org; Tue, 12 Jan 2010 07:49:46 -0500 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id o0CCnhWY019841 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 12 Jan 2010 13:49:43 +0100 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-7.2) id o0CCnh7c019840 for qemu-devel@nongnu.org; Tue, 12 Jan 2010 13:49:43 +0100 Date: Tue, 12 Jan 2010 13:49:43 +0100 From: Christoph Hellwig To: qemu-devel@nongnu.org Message-ID: <20100112124943.GB19631@lst.de> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Spam-Score: 0 () X-Scanned-By: MIMEDefang 2.39 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 2/2] qcow/qcow2: implement bdrv_aio_flush X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Kevin Wolf Now that we do not have to flush the backing device anymore implementing the bdrv_aio_flush method for image formats is trivial. [hch: forward ported to qemu mainline from a product tree] Signed-off-by: Kevin Wolf Signed-off-by: Christoph Hellwig Index: qemu/block/qcow2.c =================================================================== --- qemu.orig/block/qcow2.c 2010-01-12 11:43:13.745003589 +0100 +++ qemu/block/qcow2.c 2010-01-12 11:43:33.502003548 +0100 @@ -1012,6 +1012,14 @@ static void qcow_flush(BlockDriverState bdrv_flush(s->hd); } +static BlockDriverAIOCB *qcow_aio_flush(BlockDriverState *bs, + BlockDriverCompletionFunc *cb, void *opaque) +{ + BDRVQcowState *s = bs->opaque; + + return bdrv_aio_flush(s->hd, cb, opaque); +} + static int64_t qcow_vm_state_offset(BDRVQcowState *s) { return (int64_t)s->l1_vm_state_index << (s->cluster_bits + s->l2_bits); @@ -1126,6 +1134,7 @@ static BlockDriver bdrv_qcow2 = { .bdrv_aio_readv = qcow_aio_readv, .bdrv_aio_writev = qcow_aio_writev, + .bdrv_aio_flush = qcow_aio_flush, .bdrv_write_compressed = qcow_write_compressed, .bdrv_snapshot_create = qcow2_snapshot_create, Index: qemu/block/qcow.c =================================================================== --- qemu.orig/block/qcow.c 2010-01-12 11:43:36.819003870 +0100 +++ qemu/block/qcow.c 2010-01-12 11:44:27.855256142 +0100 @@ -900,6 +900,14 @@ static void qcow_flush(BlockDriverState bdrv_flush(s->hd); } +static BlockDriverAIOCB *qcow_aio_flush(BlockDriverState *bs, + BlockDriverCompletionFunc *cb, void *opaque) +{ + BDRVQcowState *s = bs->opaque; + + return bdrv_aio_flush(s->hd, cb, opaque); +} + static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { BDRVQcowState *s = bs->opaque; @@ -940,6 +948,7 @@ static BlockDriver bdrv_qcow = { .bdrv_make_empty = qcow_make_empty, .bdrv_aio_readv = qcow_aio_readv, .bdrv_aio_writev = qcow_aio_writev, + .bdrv_aio_flush = qcow_aio_flush, .bdrv_write_compressed = qcow_write_compressed, .bdrv_get_info = qcow_get_info,