From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfWfS-0001sl-4A for qemu-devel@nongnu.org; Fri, 15 Jun 2012 09:34:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfWfJ-0004om-Ar for qemu-devel@nongnu.org; Fri, 15 Jun 2012 09:34:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfWfJ-0004o6-24 for qemu-devel@nongnu.org; Fri, 15 Jun 2012 09:34:17 -0400 From: Kevin Wolf Date: Fri, 15 Jun 2012 15:33:24 +0200 Message-Id: <1339767219-24297-25-git-send-email-kwolf@redhat.com> In-Reply-To: <1339767219-24297-1-git-send-email-kwolf@redhat.com> References: <1339767219-24297-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 24/39] block: always open drivers in writeback mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Paolo Bonzini Formats are entirely in charge of flushes for metadata writes. For guest-initiated writes, a writethrough cache is faked in the block layer. So we can always open in writeback mode. Signed-off-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- block.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index e4396a6..48528fd 100644 --- a/block.c +++ b/block.c @@ -649,12 +649,13 @@ static int bdrv_open_common(BlockDriverState *bs, const char *filename, bs->opaque = g_malloc0(drv->instance_size); bs->enable_write_cache = !!(flags & BDRV_O_CACHE_WB); + open_flags = flags | BDRV_O_CACHE_WB; /* * Clear flags that are internal to the block layer before opening the * image. */ - open_flags = flags & ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); + open_flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); /* * Snapshots should be writable. -- 1.7.6.5