qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 2/5] qcow: QCowAIOCB field cleanup


From: Kevin Wolf
Subject: Re: [Qemu-devel] [RFC PATCH 2/5] qcow: QCowAIOCB field cleanup
Date: Fri, 22 Jul 2011 09:01:38 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc15 Thunderbird/3.1.11

Am 20.07.2011 15:56, schrieb Frediano Ziglio:
> remove unused field from this structure and put some of them in 
> qcow_aio_read_cb and qcow_aio_write_cb
> 
> Signed-off-by: Frediano Ziglio <address@hidden>

>          qemu_co_mutex_lock(&s->lock);
>          if (ret < 0) {
>              return ret;
>          }
>      }
>  
> -    return 1;
> +    goto redo;
>  }
>  
>  static int qcow_co_readv(BlockDriverState *bs, int64_t sector_num,
> @@ -623,9 +612,7 @@ static int qcow_co_readv(BlockDriverState *bs, int64_t 
> sector_num,
>      qcow_aio_setup(bs, sector_num, qiov, nb_sectors, 0, &acb);
>  
>      qemu_co_mutex_lock(&s->lock);
> -    do {
> -        ret = qcow_aio_read_cb(&acb);
> -    } while (ret > 0);
> +    ret = qcow_aio_read_cb(&acb);
>      qemu_co_mutex_unlock(&s->lock);
>  
>      if (acb.qiov->niov > 1) {

What was wrong with the loop and return 1?

I think the old state was closer to what it should look like:
qcow_aio_read_cb should become a function that reads as much as it can
from a given offset to a given pointer and returns how much that was.
qcow_co_readv should contain the loop that calls it with the right
parameters.

Kevin



reply via email to

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