Revision 51a13528 block/rbd.c
b/block/rbd.c | ||
---|---|---|
581 | 581 |
rbd_completion_t c; |
582 | 582 |
int64_t off, size; |
583 | 583 |
char *buf; |
584 |
int r; |
|
584 | 585 |
|
585 | 586 |
BDRVRBDState *s = bs->opaque; |
586 | 587 |
|
587 | 588 |
acb = qemu_aio_get(&rbd_aio_pool, bs, cb, opaque); |
589 |
if (!acb) { |
|
590 |
return NULL; |
|
591 |
} |
|
588 | 592 |
acb->write = write; |
589 | 593 |
acb->qiov = qiov; |
590 | 594 |
acb->bounce = qemu_blockalign(bs, qiov->size); |
... | ... | |
611 | 615 |
rcb->buf = buf; |
612 | 616 |
rcb->s = acb->s; |
613 | 617 |
rcb->size = size; |
618 |
r = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c); |
|
619 |
if (r < 0) { |
|
620 |
goto failed; |
|
621 |
} |
|
614 | 622 |
|
615 | 623 |
if (write) { |
616 |
rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c); |
|
617 |
rbd_aio_write(s->image, off, size, buf, c); |
|
624 |
r = rbd_aio_write(s->image, off, size, buf, c); |
|
618 | 625 |
} else { |
619 |
rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c); |
|
620 |
rbd_aio_read(s->image, off, size, buf, c); |
|
626 |
r = rbd_aio_read(s->image, off, size, buf, c); |
|
627 |
} |
|
628 |
|
|
629 |
if (r < 0) { |
|
630 |
goto failed; |
|
621 | 631 |
} |
622 | 632 |
|
623 | 633 |
return &acb->common; |
634 |
|
|
635 |
failed: |
|
636 |
qemu_free(rcb); |
|
637 |
s->qemu_aio_count--; |
|
638 |
qemu_aio_release(acb); |
|
639 |
return NULL; |
|
624 | 640 |
} |
625 | 641 |
|
626 | 642 |
static BlockDriverAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs, |
Also available in: Unified diff