Whamcloud - gitweb
b=11817
[fs/lustre-release.git] / lustre / include / linux / lustre_lite.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4
5 #ifndef _LINUX_LL_H
6 #define _LINUX_LL_H
7
8 #ifndef _LL_H
9 #error Do not #include this file directly. #include <lustre_lite.h> instead
10 #endif
11
12 #ifdef __KERNEL__
13
14 #include <linux/version.h>
15
16 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
17 #include <asm/statfs.h>
18 #endif
19
20 #include <linux/fs.h>
21 #include <linux/dcache.h>
22 #include <linux/proc_fs.h>
23
24 #include <obd_class.h>
25 #include <lustre_net.h>
26 #include <lustre_mds.h>
27 #include <lustre_ha.h>
28
29 #include <linux/rbtree.h>
30 #include <linux/lustre_compat25.h>
31 #include <linux/pagemap.h>
32
33 #ifdef HAVE_PERCPU_COUNTER
34 #include <linux/percpu_counter.h>
35
36 typedef struct percpu_counter lcounter_t;
37
38 #define lcounter_read(counter)          (int)percpu_counter_read(counter)
39 #define lcounter_inc(counter)           percpu_counter_inc(counter)
40 #define lcounter_dec(counter)           percpu_counter_dec(counter)
41
42 #ifdef HAVE_PERCPU_2ND_ARG
43 # define lcounter_init(counter)          percpu_counter_init(counter, 0)
44 #else
45 # define lcounter_init(counter)          percpu_counter_init(counter)
46 #endif
47
48 #define lcounter_destroy(counter)       percpu_counter_destroy(counter)
49
50 #else
51 typedef struct { atomic_t count; } lcounter_t;
52
53 #define lcounter_read(counter)          atomic_read(&counter->count)
54 #define lcounter_inc(counter)           atomic_inc(&counter->count)
55 #define lcounter_dec(counter)           atomic_dec(&counter->count)
56 #define lcounter_init(counter)          atomic_set(&counter->count, 0)
57 #define lcounter_destroy(counter)       
58
59 #endif /* if defined HAVE_PERCPU_COUNTER */
60
61 /* lprocfs.c */
62 enum {
63          LPROC_LL_DIRTY_HITS = 0,
64          LPROC_LL_DIRTY_MISSES,
65          LPROC_LL_WB_WRITEPAGE,
66          LPROC_LL_WB_PRESSURE,
67          LPROC_LL_WB_OK,
68          LPROC_LL_WB_FAIL,
69          LPROC_LL_READ_BYTES,
70          LPROC_LL_WRITE_BYTES,
71          LPROC_LL_BRW_READ,
72          LPROC_LL_BRW_WRITE,
73          LPROC_LL_IOCTL,
74          LPROC_LL_OPEN,
75          LPROC_LL_RELEASE,
76          LPROC_LL_MAP,
77          LPROC_LL_LLSEEK,
78          LPROC_LL_FSYNC,
79          LPROC_LL_SETATTR,
80          LPROC_LL_TRUNC,
81          LPROC_LL_LOCKLESS_TRUNC,
82          LPROC_LL_FLOCK,
83
84 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
85          LPROC_LL_GETATTR,
86 #else
87          LPROC_LL_REVALIDATE,
88 #endif
89          LPROC_LL_STAFS,
90          LPROC_LL_ALLOC_INODE,
91          LPROC_LL_SETXATTR,
92          LPROC_LL_GETXATTR,
93          LPROC_LL_LISTXATTR,
94          LPROC_LL_REMOVEXATTR,
95          LPROC_LL_INODE_PERM,
96          LPROC_LL_DIRECT_READ,
97          LPROC_LL_DIRECT_WRITE,
98          LPROC_LL_LOCKLESS_READ,
99          LPROC_LL_LOCKLESS_WRITE,
100          LPROC_LL_FILE_OPCODES
101 };
102
103 #else
104 #include <lustre/lustre_idl.h>
105 #endif /* __KERNEL__ */
106
107 #endif