[PATCH] Vectorize aio_read/aio_write fileop methods
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / aio.c
index e41e932ba489ff040fe9ed43385fc164a8dd6515..27ff56540c731c8389c81428f40049e1a493539c 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -15,6 +15,7 @@
 #include <linux/aio_abi.h>
 #include <linux/module.h>
 #include <linux/syscalls.h>
+#include <linux/uio.h>
 
 #define DEBUG 0
 
@@ -641,7 +642,7 @@ static inline int __queue_kicked_iocb(struct kiocb *iocb)
  *     invoked both for initial i/o submission and
  *     subsequent retries via the aio_kick_handler.
  *     Expects to be invoked with iocb->ki_ctx->lock
- *     already held. The lock is released and reaquired
+ *     already held. The lock is released and reacquired
  *     as needed during processing.
  *
  * Calls the iocb retry method (already setup for the
@@ -777,11 +778,11 @@ out:
 static int __aio_run_iocbs(struct kioctx *ctx)
 {
        struct kiocb *iocb;
-       LIST_HEAD(run_list);
+       struct list_head run_list;
 
        assert_spin_locked(&ctx->ctx_lock);
 
-       list_splice_init(&ctx->run_list, &run_list);
+       list_replace_init(&ctx->run_list, &run_list);
        while (!list_empty(&run_list)) {
                iocb = list_entry(run_list.next, struct kiocb,
                        ki_run_list);
@@ -1315,8 +1316,11 @@ static ssize_t aio_pread(struct kiocb *iocb)
        ssize_t ret = 0;
 
        do {
-               ret = file->f_op->aio_read(iocb, iocb->ki_buf,
-                       iocb->ki_left, iocb->ki_pos);
+               iocb->ki_inline_vec.iov_base = iocb->ki_buf;
+               iocb->ki_inline_vec.iov_len = iocb->ki_left;
+
+               ret = file->f_op->aio_read(iocb, &iocb->ki_inline_vec,
+                                               1, iocb->ki_pos);
                /*
                 * Can't just depend on iocb->ki_left to determine
                 * whether we are done. This may have been a short read.
@@ -1349,8 +1353,11 @@ static ssize_t aio_pwrite(struct kiocb *iocb)
        ssize_t ret = 0;
 
        do {
-               ret = file->f_op->aio_write(iocb, iocb->ki_buf,
-                       iocb->ki_left, iocb->ki_pos);
+               iocb->ki_inline_vec.iov_base = iocb->ki_buf;
+               iocb->ki_inline_vec.iov_len = iocb->ki_left;
+
+               ret = file->f_op->aio_write(iocb, &iocb->ki_inline_vec,
+                                               1, iocb->ki_pos);
                if (ret > 0) {
                        iocb->ki_buf += ret;
                        iocb->ki_left -= ret;