From patchwork Mon Mar 14 17:37:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 8581991 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 006ADC0553 for ; Mon, 14 Mar 2016 17:47:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3665F201FA for ; Mon, 14 Mar 2016 17:47:54 +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 3EDCD20172 for ; Mon, 14 Mar 2016 17:47:53 +0000 (UTC) Received: from localhost ([::1]:42907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afWau-00061J-NL for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Mar 2016 13:47:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afWRf-0005LP-RV for qemu-devel@nongnu.org; Mon, 14 Mar 2016 13:38:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afWRe-000150-4h for qemu-devel@nongnu.org; Mon, 14 Mar 2016 13:38:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afWRZ-000137-Ew; Mon, 14 Mar 2016 13:38:13 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 1C988C062C96; Mon, 14 Mar 2016 17:38:13 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-76.ams2.redhat.com [10.36.116.76]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2EHbi4q014408; Mon, 14 Mar 2016 13:38:12 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 14 Mar 2016 18:37:21 +0100 Message-Id: <1457977061-28087-21-git-send-email-kwolf@redhat.com> In-Reply-To: <1457977061-28087-1-git-send-email-kwolf@redhat.com> References: <1457977061-28087-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 20/40] block: Use writeback in .bdrv_create() implementations 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 There's no reason to use a writethrough cache mode while creating an image. Signed-off-by: Kevin Wolf --- block/parallels.c | 3 ++- block/qcow.c | 3 ++- block/qcow2.c | 3 ++- block/sheepdog.c | 6 ++++-- block/vdi.c | 3 ++- block/vhdx.c | 3 ++- block/vmdk.c | 9 ++++++--- block/vpc.c | 3 ++- 8 files changed, 22 insertions(+), 11 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 645521d..3f9fd48 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -479,7 +479,8 @@ static int parallels_create(const char *filename, QemuOpts *opts, Error **errp) file = NULL; ret = bdrv_open(&file, filename, NULL, NULL, - BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err); + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, + &local_err); if (ret < 0) { error_propagate(errp, local_err); return ret; diff --git a/block/qcow.c b/block/qcow.c index 251910c..c46810c 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -798,7 +798,8 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp) qcow_bs = NULL; ret = bdrv_open(&qcow_bs, filename, NULL, NULL, - BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err); + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, + &local_err); if (ret < 0) { error_propagate(errp, local_err); goto cleanup; diff --git a/block/qcow2.c b/block/qcow2.c index 8babecd..5a79177 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2173,7 +2173,8 @@ static int qcow2_create2(const char *filename, int64_t total_size, } bs = NULL; - ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, + ret = bdrv_open(&bs, filename, NULL, NULL, + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, &local_err); if (ret < 0) { error_propagate(errp, local_err); diff --git a/block/sheepdog.c b/block/sheepdog.c index 05677ed..2488a8e 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1645,7 +1645,8 @@ static int sd_prealloc(const char *filename, Error **errp) void *buf = NULL; int ret; - ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, + ret = bdrv_open(&bs, filename, NULL, NULL, + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, errp); if (ret < 0) { goto out_with_err_set; @@ -1838,7 +1839,8 @@ static int sd_create(const char *filename, QemuOpts *opts, } bs = NULL; - ret = bdrv_open(&bs, backing_file, NULL, NULL, BDRV_O_PROTOCOL, errp); + ret = bdrv_open(&bs, backing_file, NULL, NULL, + BDRV_O_PROTOCOL | BDRV_O_CACHE_WB, errp); if (ret < 0) { goto out; } diff --git a/block/vdi.c b/block/vdi.c index b403243..12407c4 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -766,7 +766,8 @@ static int vdi_create(const char *filename, QemuOpts *opts, Error **errp) error_propagate(errp, local_err); goto exit; } - ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, + ret = bdrv_open(&bs, filename, NULL, NULL, + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, &local_err); if (ret < 0) { error_propagate(errp, local_err); diff --git a/block/vhdx.c b/block/vhdx.c index 9a51428..ea030ad 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1838,7 +1838,8 @@ static int vhdx_create(const char *filename, QemuOpts *opts, Error **errp) } bs = NULL; - ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, + ret = bdrv_open(&bs, filename, NULL, NULL, + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, &local_err); if (ret < 0) { error_propagate(errp, local_err); diff --git a/block/vmdk.c b/block/vmdk.c index 03be7f0..dd80936 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1664,7 +1664,8 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, } assert(bs == NULL); - ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, + ret = bdrv_open(&bs, filename, NULL, NULL, + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, &local_err); if (ret < 0) { error_propagate(errp, local_err); @@ -1944,7 +1945,8 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) ret = -ENOENT; goto exit; } - ret = bdrv_open(&bs, full_backing, NULL, NULL, BDRV_O_NO_BACKING, errp); + ret = bdrv_open(&bs, full_backing, NULL, NULL, + BDRV_O_NO_BACKING | BDRV_O_CACHE_WB, errp); g_free(full_backing); if (ret != 0) { goto exit; @@ -2015,7 +2017,8 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) } assert(new_bs == NULL); ret = bdrv_open(&new_bs, filename, NULL, NULL, - BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err); + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, + &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; diff --git a/block/vpc.c b/block/vpc.c index 318e6d6..1db47d6 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -886,7 +886,8 @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp) error_propagate(errp, local_err); goto out; } - ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, + ret = bdrv_open(&bs, filename, NULL, NULL, + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, &local_err); if (ret < 0) { error_propagate(errp, local_err);