]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/KernelDevice: aio_wake/wait and completion callback are exclusive
authorSage Weil <sage@redhat.com>
Wed, 3 May 2017 22:47:09 +0000 (17:47 -0500)
committerSage Weil <sage@redhat.com>
Wed, 3 May 2017 22:57:29 +0000 (17:57 -0500)
Codify that these are exclusive.  This means we don't waste time on
aio_wake in the common case of ioc's with callbacks.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/KernelDevice.cc
src/os/bluestore/NVMEDevice.cc

index 77eaf3602bc8b3e99c9975c01d4cfc181b63ae84..9fe0d3b1346be0bcd2105dce5b838232b44aade5 100644 (file)
@@ -373,9 +373,10 @@ void KernelDevice::_aio_thread()
          // destroy this ioc).  and avoid ref to ioc after aio_wake()
          // in case that triggers destruction.
          void *priv = ioc->priv;
-         ioc->aio_wake();
          if (priv) {
            aio_callback(aio_callback_priv, priv);
+         } else {
+           ioc->aio_wake();
          }
        }
       }
index 0ffdff3dda55c03955922dd1b13f232c5a2fa2f1..a093d09eb93e8ed3d524777d750aff5adec11519 100644 (file)
@@ -812,9 +812,10 @@ void io_complete(void *t, const struct spdk_nvme_cpl *completion)
     // check waiting count before doing callback (which may
     // destroy this ioc).
     if (!--ctx->num_running) {
-      ctx->aio_wake();
       if (task->device->aio_callback && ctx->priv) {
         task->device->aio_callback(task->device->aio_callback_priv, ctx->priv);
+      } else {
+       ctx->aio_wake();
       }
     }
     task->release_segs(queue);
@@ -828,10 +829,11 @@ void io_complete(void *t, const struct spdk_nvme_cpl *completion)
     // read submitted by AIO
     if(!task->return_code) {
       if (!--ctx->num_running) {
-        ctx->aio_wake();
         if (task->device->aio_callback && ctx->priv) {
           task->device->aio_callback(task->device->aio_callback_priv, ctx->priv);
-        }
+        } else {
+         ctx->aio_wake();
+       }
       }
       delete task;
     } else {