qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-stable] [Qemu-devel] [PATCH 2/2] virtio-blk: do not relay a pr


From: Eric Blake
Subject: Re: [Qemu-stable] [Qemu-devel] [PATCH 2/2] virtio-blk: do not relay a previous driver's WCE configuration to the current
Date: Thu, 19 Sep 2013 11:42:48 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

On 09/19/2013 10:48 AM, Paolo Bonzini wrote:
> The following sequence happens:

> Hence, whenever the guest is reset, the cache mode of the disk should
> be reset to whatever was specified in the "-drive" option.  With this
> change, the Linux virtio-blk driver finds that writeback caching is
> enabled, and tells the block layer to send cache flush commands
> appropriately.
> 
> Reported-by: Rusty Russell <address@hidden
> Cc: address@hidden
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  hw/block/virtio-blk.c          | 8 ++++++--
>  include/hw/virtio/virtio-blk.h | 1 +
>  2 files changed, 7 insertions(+), 2 deletions(-)

Reviewed-by: Eric Blake <address@hidden>

>  
>      features = vdev->guest_features;
> -    bdrv_set_enable_write_cache(s->bs, !!(features & (1 << 
> VIRTIO_BLK_F_WCE)));
> +    if (!(features & (1 << VIRTIO_BLK_F_CONFIG_WCE))) {
> +        bdrv_set_enable_write_cache(s->bs,
> +                                    !!(features & (1 << VIRTIO_BLK_F_WCE)));
> +    }
>  }
>  
>  static void virtio_blk_save(QEMUFile *f, void *opaque)
> @@ -674,6 +678,7 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
>      }
>  
>      blkconf_serial(&blk->conf, &blk->serial);
> +    s->original_wce = bdrv_enable_write_cache(blk->conf.bs);

At first, I was worried that this does 'bool = int', and whether that
was correct in all cases.  But looking further, bdrv_enable_write_cache
merely returns bs->enable_write_cache (also an int), but that all
assignments to bs->enable_write_cache are careful to only assign 0 or 1.
 A followup patch that changes the types to bool might be in order, but
doesn't invalidate this patch.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]