From patchwork Tue Mar 29 15:08:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 8688021 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C54D8C0553 for ; Tue, 29 Mar 2016 15:12:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2998020340 for ; Tue, 29 Mar 2016 15:12:00 +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 06987202FF for ; Tue, 29 Mar 2016 15:11:59 +0000 (UTC) Received: from localhost ([::1]:47697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akvJG-0006az-94 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Mar 2016 11:11:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akvGl-0002VM-Nd for qemu-devel@nongnu.org; Tue, 29 Mar 2016 11:09:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akvGk-00063n-NJ for qemu-devel@nongnu.org; Tue, 29 Mar 2016 11:09:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akvGd-00060f-3O; Tue, 29 Mar 2016 11:09:15 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id CFAD973037; Tue, 29 Mar 2016 15:09:14 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-120.ams2.redhat.com [10.36.116.120]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2TF912g011786; Tue, 29 Mar 2016 11:09:13 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 29 Mar 2016 17:08:05 +0200 Message-Id: <1459264128-12761-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1459264128-12761-1-git-send-email-kwolf@redhat.com> References: <1459264128-12761-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 29 Mar 2016 15:09:14 +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 Subject: [Qemu-devel] [PULL 05/48] 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 6592b35..5da7bb2 100644 --- a/block.c +++ b/block.c @@ -737,8 +737,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