From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SD945-0007u8-QK for qemu-devel@nongnu.org; Thu, 29 Mar 2012 02:42:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SD942-0006mJ-Bh for qemu-devel@nongnu.org; Thu, 29 Mar 2012 02:42:33 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:54367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SD942-0006jG-4U for qemu-devel@nongnu.org; Thu, 29 Mar 2012 02:42:30 -0400 Message-ID: <4F74044B.1010701@msgid.tls.msk.ru> Date: Thu, 29 Mar 2012 10:42:19 +0400 From: Michael Tokarev MIME-Version: 1.0 References: <1332949439-6781-1-git-send-email-stefanha@linux.vnet.ibm.com> <1332949439-6781-2-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1332949439-6781-2-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] ide: convert ide_sector_read() to asynchronous I/O List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Richard Davies , Chris Webb , qemu-devel@nongnu.org, Zhi Yong Wu , Paolo Bonzini On 28.03.2012 19:43, Stefan Hajnoczi wrote: > void ide_sector_read(IDEState *s) > { [] > + s->iov.iov_base = s->io_buffer; > + s->iov.iov_len = n * BDRV_SECTOR_SIZE; > + qemu_iovec_init_external(&s->qiov, &s->iov, 1); > + > + bdrv_acct_start(s->bs, &s->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ); > + bdrv_aio_readv(s->bs, sector_num, &s->qiov, n, > + ide_sector_read_cb, s); > } Shouldn't this function be returning something and check the return value of bdrv_aio_readv() ? I'm not sure if bdrv_aio_readv() is _supposed_ to never return any errors. In practice it is definitely a bit more complex. If bdrv_aio_readv() didn't do anything useful (ie, didn't queue the callback), we'll be busy forever. Again, I've no idea if it supposed to never return error. A block device without proper "media" present may - at least in theory - do so. If it must not, I think this should be documented somewhere that bdrv_aio_readv() does never return error, by design. That was one of the reasons I digged into the block layer in the first place - in order to understand, simplify and _document_ what each interface does. Thanks, /mjt