From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHJSM-0001yS-91 for qemu-devel@nongnu.org; Fri, 21 Oct 2011 14:04:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RHJSL-0004c6-0c for qemu-devel@nongnu.org; Fri, 21 Oct 2011 14:04:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52768) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHJSK-0004bv-MU for qemu-devel@nongnu.org; Fri, 21 Oct 2011 14:04:32 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9LI4U5v006208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Oct 2011 14:04:31 -0400 From: Kevin Wolf Date: Fri, 21 Oct 2011 19:08:32 +0200 Message-Id: <1319216912-26964-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1319216912-26964-1-git-send-email-kwolf@redhat.com> References: <1319216912-26964-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] block: Handle cache=unsafe only in raw-posix/win32 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, avi@redhat.com The expected meaning of cache=unsafe with qcow2 is that on a flush the metadata caches are written out, but no fsync is performed. Signed-off-by: Kevin Wolf --- block.c | 4 +--- block/raw-posix.c | 4 ++++ block/raw-win32.c | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 11c7f91..0b7bc06 100644 --- a/block.c +++ b/block.c @@ -2908,9 +2908,7 @@ static void coroutine_fn bdrv_flush_co_entry(void *opaque) int coroutine_fn bdrv_co_flush(BlockDriverState *bs) { - if (bs->open_flags & BDRV_O_NO_FLUSH) { - return 0; - } else if (!bs->drv) { + if (!bs->drv) { return 0; } else if (bs->drv->bdrv_co_flush) { return bs->drv->bdrv_co_flush(bs); diff --git a/block/raw-posix.c b/block/raw-posix.c index dcae88a..9a3d3af 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -380,6 +380,10 @@ static int raw_co_flush(BlockDriverState *bs) .coroutine = qemu_coroutine_self(), }; + if (bs->open_flags & BDRV_O_NO_FLUSH) { + return 0; + } + ret = fd_open(bs); if (ret < 0) { return ret; diff --git a/block/raw-win32.c b/block/raw-win32.c index f5f73bc..37a8bdb 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -156,6 +156,10 @@ static int raw_flush(BlockDriverState *bs) BDRVRawState *s = bs->opaque; int ret; + if (bs->open_flags & BDRV_O_NO_FLUSH) { + return 0; + } + ret = FlushFileBuffers(s->hfile); if (ret == 0) { return -EIO; -- 1.7.6.4