Il 19/11/2012 15:28, Stefan Priebe - Profihost AG ha scritto:
typedef struct RADOSCB {
@@ -376,6 +377,10 @@ static void qemu_rbd_complete_aio(RADOSCB *rcb)
RBDAIOCB *acb = rcb->acb;
int64_t r;
+ if (acb->bh) {
+ return;
+ }
+
r = rcb->ret;
if (acb->cmd == RBD_AIO_WRITE ||
@@ -560,6 +565,20 @@ static void qemu_rbd_close(BlockDriverState *bs)
rados_shutdown(s->cluster);
}
+static void qemu_rbd_aio_abort(void *private_data)
+{
+ RBDAIOCB *acb = (RBDAIOCB *) private_data;
+
+ acb->status = -ECANCELED;
+
+ if (acb->bh) {
+ return;
+ }
+
+ acb->bh = qemu_bh_new(rbd_aio_bh_cb, acb);
+ qemu_bh_schedule(acb->bh);
+}
I think this is all unneeded. Just store rcb->ret into
rcb->acb->status, and your version of qemu_rbd_aio_cancel should just work.
Also, I think the acb->cancelled field is not necessary anymore after
these changes.