Am 05.06.2013 um 15:28 hat Corey Bryant geschrieben:
> >>+
> >>+ if (rwr->rc == 0) {
> >>+ rwr->rc = rwr->num_sectors;
> >>+ *rwr->blob_r = g_malloc(rwr->size);
> >>+ memcpy(*rwr->blob_r, buf, rwr->size);
> >
> >Use bdrv_pread()/bdrv_pwrite() for byte-granularity I/O instead of
> >duplicating the buffering yourself.
> >
>
> Aren't bdrv_pread()/bdrv_pwrite() synchronous? Wouldn't using them
> block the main QEMU thread? That is why I switched to using the
> coroutine versions.
You need to call them from coroutine context to avoid that they invoke
their on coroutine on which they wait in this this while (!done)
{ qemu_aio_wait(); } loop that blocks everything. Called from coroutine
context, they do the Right Thing, though.
Kevin