From patchwork Mon Mar 14 15:44:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 8581011 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E71579F54C for ; Mon, 14 Mar 2016 15:45:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F3E4120260 for ; Mon, 14 Mar 2016 15:45:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 40EBD20219 for ; Mon, 14 Mar 2016 15:45:27 +0000 (UTC) Received: from localhost ([::1]:41820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afUgQ-0003aV-My for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Mar 2016 11:45:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afUg9-0003Mk-Rd for qemu-devel@nongnu.org; Mon, 14 Mar 2016 11:45:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afUg8-0002dS-S0 for qemu-devel@nongnu.org; Mon, 14 Mar 2016 11:45:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afUg5-0002Xl-DZ; Mon, 14 Mar 2016 11:45:05 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 0A4FA72082; Mon, 14 Mar 2016 15:45:05 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-76.ams2.redhat.com [10.36.116.76]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2EFisec032284; Mon, 14 Mar 2016 11:45:03 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 14 Mar 2016 16:44:51 +0100 Message-Id: <1457970292-12291-5-git-send-email-kwolf@redhat.com> In-Reply-To: <1457970292-12291-1-git-send-email-kwolf@redhat.com> References: <1457970292-12291-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 14 Mar 2016 15:45:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, jsnow@redhat.com Subject: [Qemu-devel] [PATCH 4/5] block: Make backing files always writeback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP First of all, we're generally not writing to backing files, but when we do, it's in the context of block jobs which know very well when to flush the image. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 5 +++-- tests/qemu-iotests/142.out | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/block.c b/block.c index 698e2c7..666fe61 100644 --- a/block.c +++ b/block.c @@ -762,8 +762,9 @@ static void bdrv_backing_options(int *child_flags, QDict *child_options, { int flags = parent_flags; - /* The cache mode is inherited unmodified for backing files */ - qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_WB); + /* The cache mode is inherited unmodified for backing files; except WCE, + * which is only applied on the top level (BlockBackend) */ + qdict_set_default_str(child_options, BDRV_OPT_CACHE_WB, "on"); qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_DIRECT); qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_NO_FLUSH); diff --git a/tests/qemu-iotests/142.out b/tests/qemu-iotests/142.out index b555d5a..abe94c3 100644 --- a/tests/qemu-iotests/142.out +++ b/tests/qemu-iotests/142.out @@ -62,7 +62,7 @@ cache.direct=on on backing-file cache.writeback=off on none0 Cache mode: writethrough Cache mode: writeback - Cache mode: writethrough + Cache mode: writeback Cache mode: writeback cache.writeback=off on file @@ -143,7 +143,7 @@ cache.writeback=off on none0 Cache mode: writethrough Cache mode: writethrough Cache mode: writeback - Cache mode: writethrough + Cache mode: writeback Cache mode: writeback cache.writeback=off on file @@ -302,7 +302,7 @@ cache.direct=on on backing-file cache.writeback=off on none0 Cache mode: writethrough, direct Cache mode: writeback, direct - Cache mode: writethrough, direct + Cache mode: writeback, direct Cache mode: writeback, direct cache.writeback=off on file @@ -383,7 +383,7 @@ cache.writeback=off on none0 Cache mode: writeback, direct Cache mode: writethrough Cache mode: writeback - Cache mode: writethrough + Cache mode: writeback Cache mode: writeback cache.writeback=off on file @@ -718,7 +718,7 @@ cache.direct=on on backing-file cache.writeback=off on none0 Cache mode: writethrough Cache mode: writeback - Cache mode: writethrough, direct + Cache mode: writeback, direct Cache mode: writeback, direct cache.writeback=off on file