From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qk9hA-0003fk-Ms for qemu-devel@nongnu.org; Fri, 22 Jul 2011 02:58:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qk9h8-0007Rt-VT for qemu-devel@nongnu.org; Fri, 22 Jul 2011 02:58:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qk9h8-0007RZ-NU for qemu-devel@nongnu.org; Fri, 22 Jul 2011 02:58:46 -0400 Message-ID: <4E292052.3000407@redhat.com> Date: Fri, 22 Jul 2011 09:01:38 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1311170189-29734-1-git-send-email-freddy77@gmail.com> <1311170189-29734-3-git-send-email-freddy77@gmail.com> In-Reply-To: <1311170189-29734-3-git-send-email-freddy77@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 2/5] qcow: QCowAIOCB field cleanup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Frediano Ziglio Cc: qemu-devel@nongnu.org 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 > 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