qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/2] ide: convert ide_sector_read() to asynchron


From: Michael Tokarev
Subject: Re: [Qemu-devel] [PATCH 1/2] ide: convert ide_sector_read() to asynchronous I/O
Date: Thu, 29 Mar 2012 10:42:19 +0400
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:8.0) Gecko/20120216 Icedove/8.0

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



reply via email to

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