From patchwork Tue Mar 29 15:08:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 8688171 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 911009F36E for ; Tue, 29 Mar 2016 15:18:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE890201F5 for ; Tue, 29 Mar 2016 15:18:29 +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 1872B201C0 for ; Tue, 29 Mar 2016 15:18:29 +0000 (UTC) Received: from localhost ([::1]:47783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akvPY-0001C9-4d for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Mar 2016 11:18:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akvHc-0004BT-W1 for qemu-devel@nongnu.org; Tue, 29 Mar 2016 11:10:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akvHY-0006QE-TH for qemu-devel@nongnu.org; Tue, 29 Mar 2016 11:10:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akvHT-0006Nn-I4; Tue, 29 Mar 2016 11:10:07 -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 4C57B804E5; Tue, 29 Mar 2016 15:10:07 +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 u2TF9135011786; Tue, 29 Mar 2016 11:10:05 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 29 Mar 2016 17:08:28 +0200 Message-Id: <1459264128-12761-29-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-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 28/48] qemu-img: Expand all BDRV_O_FLAGS uses 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 It always only set the BDRV_O_CACHE_WB flag, which is going to go away. In order to make the next changes more local for better reviewability this patches expands the macro. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- qemu-img.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 681cb70..4da54a8 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -58,8 +58,7 @@ typedef enum OutputFormat { OFORMAT_HUMAN, } OutputFormat; -/* Default to cache=writeback as data integrity is not important for qemu-tcg. */ -#define BDRV_O_FLAGS BDRV_O_CACHE_WB +/* Default to cache=writeback as data integrity is not important for qemu-img */ #define BDRV_DEFAULT_CACHE "writeback" static void format_print(void *opaque, const char *name) @@ -461,7 +460,7 @@ static int img_create(int argc, char **argv) } bdrv_img_create(filename, fmt, base_filename, base_fmt, - options, img_size, BDRV_O_FLAGS, &local_err, quiet); + options, img_size, BDRV_O_CACHE_WB, &local_err, quiet); if (local_err) { error_reportf_err(local_err, "%s: ", filename); goto fail; @@ -591,7 +590,7 @@ static int img_check(int argc, char **argv) BlockBackend *blk; BlockDriverState *bs; int fix = 0; - int flags = BDRV_O_FLAGS | BDRV_O_CHECK; + int flags = BDRV_O_CACHE_WB | BDRV_O_CHECK; ImageCheck *check; bool quiet = false; Error *local_err = NULL; @@ -1203,7 +1202,7 @@ static int img_compare(int argc, char **argv) /* Initialize before goto out */ qemu_progress_init(progress, 2.0); - flags = BDRV_O_FLAGS; + flags = BDRV_O_CACHE_WB; ret = bdrv_parse_cache_flags(cache, &flags); if (ret < 0) { error_report("Invalid source cache option: %s", cache); @@ -1883,7 +1882,7 @@ static int img_convert(int argc, char **argv) goto out; } - src_flags = BDRV_O_FLAGS; + src_flags = BDRV_O_CACHE_WB; ret = bdrv_parse_cache_flags(src_cache, &src_flags); if (ret < 0) { error_report("Invalid source cache option: %s", src_cache); @@ -2236,7 +2235,7 @@ static ImageInfoList *collect_image_info_list(bool image_opts, g_hash_table_insert(filenames, (gpointer)filename, NULL); blk = img_open(image_opts, filename, fmt, - BDRV_O_FLAGS | BDRV_O_NO_BACKING | BDRV_O_NO_IO, + BDRV_O_CACHE_WB | BDRV_O_NO_BACKING | BDRV_O_NO_IO, false); if (!blk) { goto err; @@ -2567,7 +2566,7 @@ static int img_map(int argc, char **argv) return 1; } - blk = img_open(image_opts, filename, fmt, BDRV_O_FLAGS, false); + blk = img_open(image_opts, filename, fmt, BDRV_O_CACHE_WB, false); if (!blk) { return 1; } @@ -2631,7 +2630,7 @@ static int img_snapshot(int argc, char **argv) Error *err = NULL; bool image_opts = false; - bdrv_oflags = BDRV_O_FLAGS | BDRV_O_RDWR; + bdrv_oflags = BDRV_O_CACHE_WB | BDRV_O_RDWR; /* Parse commandline parameters */ for(;;) { static const struct option long_options[] = { @@ -2870,7 +2869,7 @@ static int img_rebase(int argc, char **argv) goto out; } - src_flags = BDRV_O_FLAGS; + src_flags = BDRV_O_CACHE_WB; ret = bdrv_parse_cache_flags(src_cache, &src_flags); if (ret < 0) { error_report("Invalid source cache option: %s", src_cache); @@ -3221,7 +3220,7 @@ static int img_resize(int argc, char **argv) qemu_opts_del(param); blk = img_open(image_opts, filename, fmt, - BDRV_O_FLAGS | BDRV_O_RDWR, quiet); + BDRV_O_CACHE_WB | BDRV_O_RDWR, quiet); if (!blk) { ret = -1; goto out; @@ -3373,7 +3372,7 @@ static int img_amend(int argc, char **argv) goto out; } - flags = BDRV_O_FLAGS | BDRV_O_RDWR; + flags = BDRV_O_CACHE_WB | BDRV_O_RDWR; ret = bdrv_parse_cache_flags(cache, &flags); if (ret < 0) { error_report("Invalid cache option: %s", cache);