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 <fredd...@gmail.com>
> 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