qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, jcody@redhat.com,
	jsnow@redhat.com, berto@igalia.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 03/14] block: Default to enabled write cache in blk_new()
Date: Wed,  4 May 2016 11:39:14 +0200	[thread overview]
Message-ID: <1462354765-14037-4-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1462354765-14037-1-git-send-email-kwolf@redhat.com>

The existing users of the function are:

1. blk_new_open(), which already enabled the write cache
2. Some test cases that don't care about the setting
3. blockdev_init() for empty drives, where the cache mode is overridden
   with the value from the options when a medium is inserted

Therefore, this patch doesn't change the current behaviour. It will be
convenient, however, for additional users of blk_new() (like block
jobs) if the most sensible WCE setting is the default.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 6732fb4..2932a58 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -125,6 +125,8 @@ BlockBackend *blk_new(Error **errp)
 
     blk = g_new0(BlockBackend, 1);
     blk->refcnt = 1;
+    blk_set_enable_write_cache(blk, true);
+
     qemu_co_queue_init(&blk->public.throttled_reqs[0]);
     qemu_co_queue_init(&blk->public.throttled_reqs[1]);
 
@@ -165,7 +167,6 @@ BlockBackend *blk_new_open(const char *filename, const char *reference,
         return NULL;
     }
 
-    blk_set_enable_write_cache(blk, true);
     blk->root = bdrv_root_attach_child(bs, "root", &child_root);
     blk->root->opaque = blk;
 
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-04  9:40 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04  9:39 [Qemu-devel] [PATCH 00/14] block jobs: Convert I/O to BlockBackend Kevin Wolf
2016-05-04  9:39 ` [Qemu-devel] [PATCH 01/14] block: keep a list of block jobs Kevin Wolf
2016-05-13 13:09   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 02/14] block: Cancel jobs first in bdrv_close_all() Kevin Wolf
2016-05-06  9:17   ` Alberto Garcia
2016-05-13 13:14   ` Max Reitz
2016-05-04  9:39 ` Kevin Wolf [this message]
2016-05-13 13:24   ` [Qemu-devel] [PATCH 03/14] block: Default to enabled write cache in blk_new() Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 04/14] block: Convert block job core to BlockBackend Kevin Wolf
2016-05-13 13:45   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 05/14] stream: Use BlockBackend for I/O Kevin Wolf
2016-05-13 14:03   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 06/14] mirror: Allow target that already has a BlockBackend Kevin Wolf
2016-05-13 14:18   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 07/14] mirror: Use BlockBackend for I/O Kevin Wolf
2016-05-13 14:38   ` Max Reitz
2016-05-13 14:38   ` Max Reitz
2016-05-13 14:57     ` Eric Blake
2016-05-04  9:39 ` [Qemu-devel] [PATCH 08/14] backup: Don't leak BackupBlockJob in error path Kevin Wolf
2016-05-09 13:21   ` Alberto Garcia
2016-05-13 14:46   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 09/14] backup: Pack Notifier within BackupBlockJob Kevin Wolf
2016-05-13 15:01   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 10/14] backup: Remove bs parameter from backup_do_cow() Kevin Wolf
2016-05-13 15:06   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 11/14] block: Add blk_co_readv/writev() Kevin Wolf
2016-05-13 15:12   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 12/14] backup: Use BlockBackend for I/O Kevin Wolf
2016-05-13 15:25   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 13/14] commit: " Kevin Wolf
2016-05-13 15:36   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 14/14] blockjob: Remove BlockJob.bs Kevin Wolf
2016-05-13 15:37   ` 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=1462354765-14037-4-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=berto@igalia.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).