[CCID3]: Move the CCID3 defines to ccid3.h
[safe/jmp/linux-2.6] / fs / aio.c
index 674bb47..06d7d43 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -58,6 +58,7 @@ static DEFINE_SPINLOCK(fput_lock);
 static LIST_HEAD(fput_head);
 
 static void aio_kick_handler(void *);
+static void aio_queue_work(struct kioctx *);
 
 /* aio_setup
  *     Creates the slab caches used by the aio routines, panic on
@@ -747,6 +748,14 @@ out:
                 * has already been kicked */
                if (kiocbIsKicked(iocb)) {
                        __queue_kicked_iocb(iocb);
+
+                       /*
+                        * __queue_kicked_iocb will always return 1 here, because
+                        * iocb->ki_run_list is empty at this point so it should
+                        * be safe to unconditionally queue the context into the
+                        * work queue.
+                        */
+                       aio_queue_work(ctx);
                }
        }
        return ret;
@@ -1514,10 +1523,14 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
                goto out_put_req;
 
        spin_lock_irq(&ctx->ctx_lock);
-       list_add_tail(&req->ki_run_list, &ctx->run_list);
-       /* drain the run list */
-       while (__aio_run_iocbs(ctx))
-               ;
+       if (likely(list_empty(&ctx->run_list))) {
+               aio_run_iocb(req);
+       } else {
+               list_add_tail(&req->ki_run_list, &ctx->run_list);
+               /* drain the run list */
+               while (__aio_run_iocbs(ctx))
+                       ;
+       }
        spin_unlock_irq(&ctx->ctx_lock);
        aio_put_req(req);       /* drop extra ref to req */
        return 0;