From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sc1sO-0004eZ-Bn for qemu-devel@nongnu.org; Tue, 05 Jun 2012 18:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sc1sM-00015x-Kj for qemu-devel@nongnu.org; Tue, 05 Jun 2012 18:05:19 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:40874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sc1sM-0000zZ-Bm for qemu-devel@nongnu.org; Tue, 05 Jun 2012 18:05:18 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so8716928pbb.4 for ; Tue, 05 Jun 2012 15:05:17 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 6 Jun 2012 00:04:53 +0200 Message-Id: <1338933895-20677-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1338933895-20677-1-git-send-email-pbonzini@redhat.com> References: <1338933895-20677-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v3 5/7] block: always open drivers in writeback mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com 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 --- block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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.10.1