[PATCH] knfsd: tidy up up meaning of 'buffer size' in nfsd/sunrpc
[pandora-kernel.git] / include / linux / aio.h
index 403d71d..0d71c00 100644 (file)
@@ -4,8 +4,10 @@
 #include <linux/list.h>
 #include <linux/workqueue.h>
 #include <linux/aio_abi.h>
+#include <linux/uio.h>
 
 #include <asm/atomic.h>
+#include <linux/uio.h>
 
 #define AIO_MAXSEGS            4
 #define AIO_KIOGRP_NR_ATOMIC   8
@@ -94,26 +96,29 @@ struct kiocb {
        ssize_t                 (*ki_retry)(struct kiocb *);
        void                    (*ki_dtor)(struct kiocb *);
 
-       struct list_head        ki_list;        /* the aio core uses this
-                                                * for cancellation */
-
        union {
                void __user             *user;
                struct task_struct      *tsk;
        } ki_obj;
+
        __u64                   ki_user_data;   /* user's data for completion */
+       wait_queue_t            ki_wait;
        loff_t                  ki_pos;
+
+       void                    *private;
        /* State that we remember to be able to restart/retry  */
        unsigned short          ki_opcode;
        size_t                  ki_nbytes;      /* copy of iocb->aio_nbytes */
        char                    __user *ki_buf; /* remaining iocb->aio_buf */
        size_t                  ki_left;        /* remaining bytes */
-       wait_queue_t            ki_wait;
        long                    ki_retried;     /* just for testing */
-       long                    ki_kicked;      /* just for testing */
-       long                    ki_queued;      /* just for testing */
+       struct iovec            ki_inline_vec;  /* inline vector */
+       struct iovec            *ki_iovec;
+       unsigned long           ki_nr_segs;
+       unsigned long           ki_cur_seg;
 
-       void                    *private;
+       struct list_head        ki_list;        /* the aio core uses this
+                                                * for cancellation */
 };
 
 #define is_sync_kiocb(iocb)    ((iocb)->ki_key == KIOCB_SYNC_KEY)
@@ -124,8 +129,9 @@ struct kiocb {
                (x)->ki_users = 1;                      \
                (x)->ki_key = KIOCB_SYNC_KEY;           \
                (x)->ki_filp = (filp);                  \
-               (x)->ki_ctx = &tsk->active_mm->default_kioctx;  \
+               (x)->ki_ctx = NULL;                     \
                (x)->ki_cancel = NULL;                  \
+               (x)->ki_retry = NULL;                   \
                (x)->ki_dtor = NULL;                    \
                (x)->ki_obj.tsk = tsk;                  \
                (x)->ki_user_data = 0;                  \
@@ -210,8 +216,15 @@ struct kioctx *lookup_ioctx(unsigned long ctx_id);
 int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
                                  struct iocb *iocb));
 
-#define get_ioctx(kioctx)      do { if (unlikely(atomic_read(&(kioctx)->users) <= 0)) BUG(); atomic_inc(&(kioctx)->users); } while (0)
-#define put_ioctx(kioctx)      do { if (unlikely(atomic_dec_and_test(&(kioctx)->users))) __put_ioctx(kioctx); else if (unlikely(atomic_read(&(kioctx)->users) < 0)) BUG(); } while (0)
+#define get_ioctx(kioctx) do {                                         \
+       BUG_ON(atomic_read(&(kioctx)->users) <= 0);                     \
+       atomic_inc(&(kioctx)->users);                                   \
+} while (0)
+#define put_ioctx(kioctx) do {                                         \
+       BUG_ON(atomic_read(&(kioctx)->users) <= 0);                     \
+       if (unlikely(atomic_dec_and_test(&(kioctx)->users)))            \
+               __put_ioctx(kioctx);                                    \
+} while (0)
 
 #define in_aio() !is_sync_wait(current->io_wait)
 /* may be used for debugging */