All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 10/20] block: Move enable_write_cache to BB level
Date: Sat, 26 Mar 2016 20:54:05 +0100	[thread overview]
Message-ID: <56F6E8DD.7010809@redhat.com> (raw)
In-Reply-To: <1458325289-17848-11-git-send-email-kwolf@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2301 bytes --]

On 18.03.2016 19:21, Kevin Wolf wrote:
> Whether a write cache is used or not is a decision that concerns the
> user (e.g. the guest device) rather than the backend. It was already
> logically part of the BB level as bdrv_move_feature_fields() always kept
> it on top of the BDS tree; with this patch, the core of it (the actual
> flag and the additional flushes) is also implemented there.
> 
> Direct callers of bdrv_open() must pass BDRV_O_CACHE_WB now if bs
> doesn't have a BlockBackend attached.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block.c                    | 26 +++++++++++++++++---------
>  block/block-backend.c      | 42 +++++++++++++++++++++++++++---------------
>  block/io.c                 |  2 +-
>  block/iscsi.c              |  2 +-
>  include/block/block.h      |  1 +
>  include/block/block_int.h  |  3 ---
>  tests/qemu-iotests/142     |  4 ++--
>  tests/qemu-iotests/142.out |  8 ++++----
>  8 files changed, 53 insertions(+), 35 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>

I'm not so sure about the state bdrv_{set_,}enable_write_cache() are in
after this patch (e.g. the NBD client will always think the write cache
is enabled; and bdrv_set_enable_write_cache() can be used to unset
BDRV_O_CACHE_WB on BDSs), but looking at the following patches' titles,
they'll clear that up.

It appears to me that multiwrite will ignore the writethrough status,
but then again, qemu-io seems to be the only multiwrite user.

> diff --git a/block.c b/block.c
> index 172f865..9271dbb 100644
> --- a/block.c
> +++ b/block.c

[...]

> @@ -3618,8 +3626,8 @@ void bdrv_img_create(const char *filename, const char *fmt,
>              }
>  
>              /* backing files always opened read-only */
> -            back_flags =
> -                flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
> +            back_flags = flags | BDRV_O_CACHE_WB;
> +            back_flags &= ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);

Actually, this is the only thing the @flags parameter of this function
is used for. Maybe it can be dropped since we already regulate the
back_flags pretty strictly.

>  
>              if (backing_fmt) {
>                  backing_options = qdict_new();


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-03-26 19:54 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 ` [Qemu-devel] [PATCH 04/20] qemu-img: Expand all BDRV_O_FLAGS uses Kevin Wolf
2016-03-26 17:34   ` 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 [this message]
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=56F6E8DD.7010809@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@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.