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