]> bbs.cooldavid.org Git - net-next-2.6.git/blame - fs/aio.c
xps: Transmit Packet Steering
[net-next-2.6.git] / fs / aio.c
CommitLineData
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>
b9d128f1 18#include <linux/backing-dev.h>
027445c3 19#include <linux/uio.h>
1da177e4
LT
20
21#define DEBUG 0
22
23#include <linux/sched.h>
24#include <linux/fs.h>
25#include <linux/file.h>
26#include <linux/mm.h>
27#include <linux/mman.h>
3d2d827f 28#include <linux/mmu_context.h>
1da177e4
LT
29#include <linux/slab.h>
30#include <linux/timer.h>
31#include <linux/aio.h>
32#include <linux/highmem.h>
33#include <linux/workqueue.h>
34#include <linux/security.h>
9c3060be 35#include <linux/eventfd.h>
cfb1e33e
JM
36#include <linux/blkdev.h>
37#include <linux/mempool.h>
38#include <linux/hash.h>
9d85cba7 39#include <linux/compat.h>
1da177e4
LT
40
41#include <asm/kmap_types.h>
42#include <asm/uaccess.h>
1da177e4
LT
43
44#if DEBUG > 1
45#define dprintk printk
46#else
47#define dprintk(x...) do { ; } while (0)
48#endif
49
1da177e4 50/*------ sysctl variables----*/
d55b5fda
ZB
51static DEFINE_SPINLOCK(aio_nr_lock);
52unsigned long aio_nr; /* current system wide number of aio requests */
53unsigned long aio_max_nr = 0x10000; /* system wide maximum number of aio requests */
1da177e4
LT
54/*----end sysctl variables---*/
55
e18b890b
CL
56static struct kmem_cache *kiocb_cachep;
57static struct kmem_cache *kioctx_cachep;
1da177e4
LT
58
59static struct workqueue_struct *aio_wq;
60
61/* Used for rare fput completion. */
65f27f38
DH
62static void aio_fput_routine(struct work_struct *);
63static DECLARE_WORK(fput_work, aio_fput_routine);
1da177e4
LT
64
65static DEFINE_SPINLOCK(fput_lock);
25ee7e38 66static LIST_HEAD(fput_head);
1da177e4 67
cfb1e33e
JM
68#define AIO_BATCH_HASH_BITS 3 /* allocated on-stack, so don't go crazy */
69#define AIO_BATCH_HASH_SIZE (1 << AIO_BATCH_HASH_BITS)
70struct aio_batch_entry {
71 struct hlist_node list;
72 struct address_space *mapping;
73};
74mempool_t *abe_pool;
75
65f27f38 76static void aio_kick_handler(struct work_struct *);