Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

aio: kill ki_key

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>
Reviewed-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Kent Overstreet and committed by
Linus Torvalds
8a660890 4e23bcae

+9 -7
+5 -2
fs/aio.c
··· 1159 1159 } 1160 1160 } 1161 1161 1162 - ret = put_user(req->ki_key, &user_iocb->aio_key); 1162 + ret = put_user(KIOCB_KEY, &user_iocb->aio_key); 1163 1163 if (unlikely(ret)) { 1164 1164 pr_debug("EFAULT: aio_key\n"); 1165 1165 goto out_put_req; ··· 1281 1281 1282 1282 assert_spin_locked(&ctx->ctx_lock); 1283 1283 1284 + if (key != KIOCB_KEY) 1285 + return NULL; 1286 + 1284 1287 /* TODO: use a hash or array, this sucks. */ 1285 1288 list_for_each(pos, &ctx->active_reqs) { 1286 1289 struct kiocb *kiocb = list_kiocb(pos); 1287 - if (kiocb->ki_obj.user == iocb && kiocb->ki_key == key) 1290 + if (kiocb->ki_obj.user == iocb) 1288 1291 return kiocb; 1289 1292 } 1290 1293 return NULL;
+4 -5
include/linux/aio.h
··· 12 12 struct kioctx; 13 13 struct kiocb; 14 14 15 - #define KIOCB_SYNC_KEY (~0U) 15 + #define KIOCB_KEY 0 16 16 17 17 /* 18 18 * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either ··· 56 56 */ 57 57 struct kiocb { 58 58 atomic_t ki_users; 59 - unsigned ki_key; /* id of this request */ 60 59 61 60 struct file *ki_filp; 62 - struct kioctx *ki_ctx; /* may be NULL for sync ops */ 61 + struct kioctx *ki_ctx; /* NULL for sync ops */ 63 62 kiocb_cancel_fn *ki_cancel; 64 63 ssize_t (*ki_retry)(struct kiocb *); 65 64 void (*ki_dtor)(struct kiocb *); ··· 94 95 95 96 static inline bool is_sync_kiocb(struct kiocb *kiocb) 96 97 { 97 - return kiocb->ki_key == KIOCB_SYNC_KEY; 98 + return kiocb->ki_ctx == NULL; 98 99 } 99 100 100 101 static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) 101 102 { 102 103 *kiocb = (struct kiocb) { 103 104 .ki_users = ATOMIC_INIT(1), 104 - .ki_key = KIOCB_SYNC_KEY, 105 + .ki_ctx = NULL, 105 106 .ki_filp = filp, 106 107 .ki_obj.tsk = current, 107 108 };