@@ -315,13 +315,16 @@ done:
static void rbd_aio_completion_cb(void *opaque)
{
BDRVRBDState *s = opaque;
+ RBDAIOCB *acb;
- uint64_t val;
ssize_t ret;
do {
- if ((ret = read(s->efd, &val, sizeof(val))) > 0) {
- s->qemu_aio_count -= val;
+ if ((ret = read(s->efd, &acb, sizeof(acb))) > 0) {
+ s->qemu_aio_count --;
+ if (!acb->aiocnt && acb->bh) {
+ qemu_bh_schedule(acb->bh);
+ }
}
} while (ret < 0 && errno == EINTR);
@@ -539,7 +542,6 @@ static void rbd_finish_aiocb(rados_completion_t c,
RADOSCB *rcb)
{
RBDAIOCB *acb = rcb->acb;
int64_t r;
- uint64_t buf = 1;
int i;