Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * An async IO implementation for Linux | |
3 | * Written by Benjamin LaHaise <bcrl@kvack.org> | |
4 | * | |
5 | * Implements an efficient asynchronous io interface. | |
6 | * | |
7 | * Copyright 2000, 2001, 2002 Red Hat, Inc. All Rights Reserved. | |
8 | * | |
9 | * See ../COPYING for licensing terms. | |
10 | */ | |
11 | #include <linux/kernel.h> | |
12 | #include <linux/init.h> | |
13 | #include <linux/errno.h> | |
14 | #include <linux/time.h> | |
15 | #include <linux/aio_abi.h> | |
16 | #include <linux/module.h> | |
17 | #include <linux/syscalls.h> | |
027445c3 | 18 | #include <linux/uio.h> |
1da177e4 LT |
19 | |
20 | #define DEBUG 0 | |
21 | ||
22 | #include <linux/sched.h> | |
23 | #include <linux/fs.h> | |
24 | #include <linux/file.h> | |
25 | #include <linux/mm.h> | |
26 | #include <linux/mman.h> | |
27 | #include <linux/slab.h> | |
28 | #include <linux/timer.h> | |
29 | #include <linux/aio.h> | |
30 | #include <linux/highmem.h> | |
31 | #include <linux/workqueue.h> | |
32 | #include <linux/security.h> | |
9c3060be | 33 | #include <linux/eventfd.h> |
1da177e4 LT |
34 | |
35 | #include <asm/kmap_types.h> | |
36 | #include <asm/uaccess.h> | |
37 | #include <asm/mmu_context.h> | |
38 | ||
39 | #if DEBUG > 1 | |
40 | #define dprintk printk | |
41 | #else | |
42 | #define dprintk(x...) do { ; } while (0) | |
43 | #endif | |
44 | ||
1da177e4 | 45 | /*------ sysctl variables----*/ |
d55b5fda ZB |
46 | static DEFINE_SPINLOCK(aio_nr_lock); |
47 | unsigned long aio_nr; /* current system wide number of aio requests */ | |
48 | unsigned long aio_max_nr = 0x10000; /* system wide maximum number of aio requests */ | |
1da177e4 LT |
49 | /*----end sysctl variables---*/ |
50 | ||
e18b890b CL |
51 | static struct kmem_cache *kiocb_cachep; |
52 | static struct kmem_cache *kioctx_cachep; | |
1da177e4 LT |
53 | |
54 | static struct workqueue_struct *aio_wq; | |
55 | ||
56 | /* Used for rare fput completion. */ | |
65f27f38 DH |
57 | static void aio_fput_routine(struct work_struct *); |
58 | static DECLARE_WORK(fput_work, aio_fput_routine); | |
1da177e4 LT |
59 | |
60 | static DEFINE_SPINLOCK(fput_lock); | |
25ee7e38 | 61 | static LIST_HEAD(fput_head); |
1da177e4 | 62 | |
65f27f38 | 63 | static void aio_kick_handler(struct work_struct *); |