Am 19.11.2012 15:41, schrieb Paolo Bonzini:
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.
The iscsi driver still relies on canceled that's why i left it here in too.
So you mean in qemu_rbd_complete_aio i should remove the check for
cancelled and then just overwrite acb->status to that it changes from
-EINPROGRESS to something else?
And qemu_rbd_aio_cancel should just wait for status != -EINPROGRESS?
Stefan