qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] Combine bdrv_read and bdrv_write to bdrv_rw


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/3] Combine bdrv_read and bdrv_write to bdrv_rw
Date: Wed, 29 Feb 2012 16:53:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

Il 29/02/2012 00:54, Michael Tokarev ha scritto:
> -static coroutine_fn int cow_co_write(BlockDriverState *bs, int64_t 
> sector_num,
> -                                     const uint8_t *buf, int nb_sectors)
> +static coroutine_fn int cow_co_rw(BlockDriverState *bs, int64_t sector_num,
> +                                  uint8_t *buf, int nb_sectors, bool 
> is_write)
>  {
>      int ret;
>      BDRVCowState *s = bs->opaque;
>      qemu_co_mutex_lock(&s->lock);
> -    ret = cow_write(bs, sector_num, buf, nb_sectors);
> +    ret = is_write ? cow_write(bs, sector_num, buf, nb_sectors) :
> +                     cow_read(bs, sector_num, buf, nb_sectors);
>      qemu_co_mutex_unlock(&s->lock);
>      return ret;

NACK,

the real cleanup here would be to move the lock/unlock inside cow_read
and cow_write.

Paolo



reply via email to

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