summaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2013-05-07 19:18:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-07 21:38:28 -0400
commit4e179bca6718693148c7445c236bc3e0e0013ffd (patch)
tree2830668902bcdddd6c8e74e8d9dba226efdc5ad4 /fs/aio.c
parent906b973cf0ae8f10a6e8182845729b2ecc0da95a (diff)
aio: move private stuff out of aio.h
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> Acked-by: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Cc: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/fs/aio.c b/fs/aio.c
index dbfcd67003ef..670cb8b84345 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -45,6 +45,67 @@
45#define dprintk(x...) do { ; } while (0) 45#define dprintk(x...) do { ; } while (0)
46#endif 46#endif
47 47
48#define AIO_RING_MAGIC 0xa10a10a1
49#define AIO_RING_COMPAT_FEATURES 1
50#define AIO_RING_INCOMPAT_FEATURES 0
51struct aio_ring {
52 unsigned id; /* kernel internal index number */
53 unsigned nr; /* number of io_events */
54 unsigned head;
55 unsigned tail;
56
57 unsigned magic;
58 unsigned compat_features;
59 unsigned incompat_features;
60 unsigned header_length; /* size of aio_ring */
61
62
63 struct io_event io_events[0];
64}; /* 128 bytes + ring size */
65
66#define AIO_RING_PAGES 8
67struct aio_ring_info {
68 unsigned long mmap_base;
69 unsigned long mmap_size;
70
71 struct page **ring_pages;
72 spinlock_t ring_lock;
73 long nr_pages;
74
75 unsigned nr, tail;
76
77 struct page *internal_pages[AIO_RING_PAGES];
78};
79
80static inline unsigned aio_ring_avail(struct aio_ring_info *info,
81 struct aio_ring *ring)
82{
83 return (ring->head + info->nr - 1 - ring->tail) % info->nr;
84}
85
86struct kioctx {
87 atomic_t users;
88 int dead;
89
90 /* This needs improving */
91 unsigned long user_id;
92 struct hlist_node list;
93
94 wait_queue_head_t wait;
95
96 spinlock_t ctx_lock;
97
98 int reqs_active;
99 struct list_head active_reqs; /* used for cancellation */
100
101 /* sys_io_setup currently limits this to an unsigned int */
102 unsigned max_reqs;
103
104 struct aio_ring_info ring_info;
105
106 struct rcu_head rcu_head;
107};
108
48/*------ sysctl variables----*/ 109/*------ sysctl variables----*/
49static DEFINE_SPINLOCK(aio_nr_lock); 110static DEFINE_SPINLOCK(aio_nr_lock);
50unsigned long aio_nr; /* current system wide number of aio requests */ 111unsigned long aio_nr; /* current system wide number of aio requests */