]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
aio: kill ki_key
authorKent Overstreet <koverstreet@google.com>
Sun, 10 Mar 2013 10:55:44 +0000 (21:55 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 12 Mar 2013 03:57:44 +0000 (14:57 +1100)
ki_key wasn't actually used for anything previously - it was always 0.
Drop it to trim struct kiocb a bit.

Signed-off-by: Kent Overstreet <koverstreet@google.com>
Cc: Zach Brown <zab@redhat.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Selvan Mani <smani@micron.com>
Cc: Sam Bradshaw <sbradshaw@micron.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/aio.c
include/linux/aio.h

index 51ebd2dcd632f48438348b4b8776109e5ca1d2c0..407e8e3b4deaedb7d4304a21c63eaab32c1971de 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1206,7 +1206,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
                }
        }
 
-       ret = put_user(req->ki_key, &user_iocb->aio_key);
+       ret = put_user(KIOCB_KEY, &user_iocb->aio_key);
        if (unlikely(ret)) {
                pr_debug("EFAULT: aio_key\n");
                goto out_put_req;
@@ -1327,10 +1327,13 @@ static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
 
        assert_spin_locked(&ctx->ctx_lock);
 
+       if (key != KIOCB_KEY)
+               return NULL;
+
        /* TODO: use a hash or array, this sucks. */
        list_for_each(pos, &ctx->active_reqs) {
                struct kiocb *kiocb = list_kiocb(pos);
-               if (kiocb->ki_obj.user == iocb && kiocb->ki_key == key)
+               if (kiocb->ki_obj.user == iocb)
                        return kiocb;
        }
        return NULL;
index f0a8481af99b9a8ff86c3032492647d7cacb9c29..7308836dd0452efe1768c3752336f6ade04d358f 100644 (file)
@@ -12,7 +12,7 @@
 struct kioctx;
 struct kiocb;
 
-#define KIOCB_SYNC_KEY         (~0U)
+#define KIOCB_KEY              0
 
 /*
  * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either
@@ -56,10 +56,9 @@ typedef int (kiocb_cancel_fn)(struct kiocb *, struct io_event *);
  */
 struct kiocb {
        atomic_t                ki_users;
-       unsigned                ki_key;         /* id of this request */
 
        struct file             *ki_filp;
-       struct kioctx           *ki_ctx;        /* may be NULL for sync ops */
+       struct kioctx           *ki_ctx;        /* NULL for sync ops */
        kiocb_cancel_fn         *ki_cancel;
        ssize_t                 (*ki_retry)(struct kiocb *);
        void                    (*ki_dtor)(struct kiocb *);
@@ -95,14 +94,14 @@ struct kiocb {
 
 static inline bool is_sync_kiocb(struct kiocb *kiocb)
 {
-       return kiocb->ki_key == KIOCB_SYNC_KEY;
+       return kiocb->ki_ctx == NULL;
 }
 
 static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
 {
        *kiocb = (struct kiocb) {
                        .ki_users = ATOMIC_INIT(1),
-                       .ki_key = KIOCB_SYNC_KEY,
+                       .ki_ctx = NULL,
                        .ki_filp = filp,
                        .ki_obj.tsk = current,
                };