qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1.2 5/7] block: add bdrv_set_enable_write_cache


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 1.2 5/7] block: add bdrv_set_enable_write_cache
Date: Thu, 31 May 2012 13:44:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Am 22.05.2012 18:17, schrieb Paolo Bonzini:
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  block.c |    5 +++++
>  block.h |    1 +
>  2 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/block.c b/block.c
> index b682764..bb709c2 100644
> --- a/block.c
> +++ b/block.c
> @@ -2369,6 +2369,11 @@ int bdrv_enable_write_cache(BlockDriverState *bs)
>      return bs->enable_write_cache;
>  }
>  
> +void bdrv_set_enable_write_cache(BlockDriverState *bs, bool wce)
> +{
> +    bs->enable_write_cache = wce;
> +}

I think we should have a flush here if bs->enable_write_cache && !wce,
it's not really something that could differ between device models. I see
that you're doing it in your IDE patch by calling ide_flush_cache()
which looks like this:

void ide_flush_cache(IDEState *s)
{
    if (s->bs == NULL) {
        ide_flush_cb(s, 0);
        return;
    }

    bdrv_acct_start(s->bs, &s->acct, 0, BDRV_ACCT_FLUSH);
    bdrv_aio_flush(s->bs, ide_flush_cb, s);
}

I don't think this flush should be accounted, because it's only
indirectly initiated by the guest.

Kevin



reply via email to

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