All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH 04/20] qemu-img: Expand all BDRV_O_FLAGS uses
Date: Fri, 18 Mar 2016 19:21:13 +0100	[thread overview]
Message-ID: <1458325289-17848-5-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1458325289-17848-1-git-send-email-kwolf@redhat.com>

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 <kwolf@redhat.com>
---
 qemu-img.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index 29eae2a..839e05b 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)
@@ -460,7 +459,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;
@@ -590,7 +589,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;
@@ -1202,7 +1201,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);
@@ -1882,7 +1881,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);
@@ -2235,7 +2234,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_CACHE_WB | BDRV_O_NO_BACKING,
                        false, false);
         if (!blk) {
             goto err;
@@ -2566,7 +2565,7 @@ static int img_map(int argc, char **argv)
         return 1;
     }
 
-    blk = img_open(image_opts, filename, fmt, BDRV_O_FLAGS, true, false);
+    blk = img_open(image_opts, filename, fmt, BDRV_O_CACHE_WB, true, false);
     if (!blk) {
         return 1;
     }
@@ -2630,7 +2629,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[] = {
@@ -2869,7 +2868,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);
@@ -3220,7 +3219,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, true, quiet);
+                   BDRV_O_CACHE_WB | BDRV_O_RDWR, true, quiet);
     if (!blk) {
         ret = -1;
         goto out;
@@ -3372,7 +3371,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);
-- 
1.8.3.1

  parent reply	other threads:[~2016-03-18 18:21 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18 18:21 [Qemu-devel] [PATCH 00/20] block: Implement writethrough in BlockBackend Kevin Wolf
2016-03-18 18:21 ` [Qemu-devel] [PATCH 01/20] block: Add bdrv_parse_cache_mode() Kevin Wolf
2016-03-26 17:05   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 02/20] qemu-nbd: Call blk_set_enable_write_cache() explicitly Kevin Wolf
2016-03-26 17:09   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 03/20] qemu-io: " Kevin Wolf
2016-03-26 17:18   ` Max Reitz
2016-03-18 18:21 ` Kevin Wolf [this message]
2016-03-26 17:34   ` [Qemu-devel] [PATCH 04/20] qemu-img: Expand all BDRV_O_FLAGS uses Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 05/20] qemu-img: Call blk_set_enable_write_cache() explicitly Kevin Wolf
2016-03-26 17:54   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 06/20] xen_disk: " Kevin Wolf
2016-03-22 11:08   ` Stefano Stabellini
2016-03-26 17:59   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 07/20] block: blockdev_init(): " Kevin Wolf
2016-03-26 18:13   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 08/20] block: Always set writeback mode in blk_new_open() Kevin Wolf
2016-03-26 18:36   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 09/20] block: Handle flush error in bdrv_pwrite_sync() Kevin Wolf
2016-03-26 18:46   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 10/20] block: Move enable_write_cache to BB level Kevin Wolf
2016-03-26 19:54   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 11/20] block/qapi: Use blk_enable_write_cache() Kevin Wolf
2016-03-26 20:14   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 12/20] block: Introduce bdrv_co_writev_flags() Kevin Wolf
2016-03-26 20:24   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 13/20] iscsi: Support BDRV_REQ_FUA Kevin Wolf
2016-03-26 20:33   ` Max Reitz
2016-03-26 20:44   ` Max Reitz
2016-03-29 11:02     ` Kevin Wolf
2016-03-18 18:21 ` [Qemu-devel] [PATCH 14/20] nbd: " Kevin Wolf
2016-03-26 20:46   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 15/20] raw: " Kevin Wolf
2016-03-26 20:49   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 16/20] block: Use bdrv_parse_cache_mode() in drive_init() Kevin Wolf
2016-03-26 20:53   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 17/20] qemu-io: Use bdrv_parse_cache_mode() in reopen_f() Kevin Wolf
2016-03-26 21:05   ` Max Reitz
2016-03-29 10:16     ` Kevin Wolf
2016-03-18 18:21 ` [Qemu-devel] [PATCH 18/20] block: Remove bdrv_parse_cache_flags() Kevin Wolf
2016-03-26 21:06   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 19/20] block: Remove BDRV_O_CACHE_WB Kevin Wolf
2016-03-26 21:23   ` Max Reitz
2016-03-18 18:21 ` [Qemu-devel] [PATCH 20/20] block: Remove bdrv_(set_)enable_write_cache() Kevin Wolf
2016-03-26 21:25   ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458325289-17848-5-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.