Whamcloud - gitweb
Add llite file flag to allow skipping the locking for file read/write ops.
[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  * lustre lite cluster file system
5  * 
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  * 
9  *
10  *
11
12
13
14 #ifndef _LL_H
15 #define _LL_H
16
17 #include <linux/fs.h>
18 #include <linux/ext2_fs.h>
19
20 #include <linux/lustre_net.h>
21 #include <linux/lustre_mds.h>
22 #include <linux/lustre_ha.h>
23 #include <linux/obdo.h>
24
25 extern kmem_cache_t *ll_file_data_slab;
26 struct ll_file_data {
27         __u64 fd_mdshandle;
28         struct ptlrpc_request *fd_req;
29         __u32 fd_flags;
30 };
31
32 #define LL_IOC_GETFLAGS                 _IOR ('f', 151, long)
33 #define LL_IOC_SETFLAGS                 _IOW ('f', 152, long)
34 #define LL_IOC_CLRFLAGS                 _IOW ('f', 153, long)
35
36 #define LL_FILE_IGNORE_LOCK             0x00000001
37
38 #define LL_INLINESZ      60
39 struct ll_inode_info {
40         int              lli_flags;
41         __u64            lli_objid; 
42         char             lli_inline[LL_INLINESZ];
43 };
44
45 #define LL_SUPER_MAGIC 0x0BD00BD0
46
47 #define LL_COMMITCBD_STOPPING  0x1
48 #define LL_COMMITCBD_STOPPED   0x2
49 #define LL_COMMITCBD_RUNNING   0x4
50
51 struct ll_sb_info {
52         struct obd_conn           ll_conn;
53         ino_t                     ll_rootino; /* number of root inode */
54         struct ptlrpc_client      ll_mds_client;
55         struct ptlrpc_connection *ll_mds_conn;
56         struct ldlm_namespace    *ll_namespace;
57
58         wait_queue_head_t         ll_commitcbd_waitq;
59         wait_queue_head_t         ll_commitcbd_ctl_waitq;
60         int                       ll_commitcbd_flags;
61         struct task_struct        *ll_commitcbd_thread;
62         time_t                    ll_commitcbd_waketime;
63         time_t                    ll_commitcbd_timeout;
64         spinlock_t                ll_commitcbd_lock;
65 };
66
67
68 static inline struct ll_sb_info *ll_s2sbi(struct super_block *sb)
69 {
70         return (struct ll_sb_info *)(sb->u.generic_sbp);
71 }
72
73 static inline struct obd_conn *ll_s2obdconn(struct super_block *sb)
74 {
75         return &(ll_s2sbi(sb))->ll_conn;
76 }
77
78 static inline struct ll_sb_info *ll_i2sbi(struct inode *inode)
79 {
80         return ll_s2sbi(inode->i_sb);
81 }
82
83 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
84 {
85         return (struct ll_inode_info *)&(inode->u.generic_ip);
86 }
87
88 static inline int ll_has_inline(struct inode *inode)
89 {
90         return (ll_i2info(inode)->lli_flags & OBD_FL_INLINEDATA);
91 }
92
93
94 static inline struct obd_conn *ll_i2obdconn(struct inode *inode)
95 {
96         return ll_s2obdconn(inode->i_sb);
97 }
98
99 static inline void ll_ino2fid(struct ll_fid *fid, ino_t ino, __u32 generation,
100                               int type)
101 {
102         fid->id = (__u64)ino;
103         fid->generation = generation;
104         fid->f_type = type;
105 }
106
107 static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
108 {
109         ll_ino2fid(fid, inode->i_ino, inode->i_generation,
110                    inode->i_mode & S_IFMT);
111 }
112
113 /* dir.c */
114 extern struct file_operations ll_dir_operations;
115 extern struct inode_operations ll_dir_inode_operations;
116
117 /* file.c */
118 extern struct file_operations ll_file_operations;
119 extern struct inode_operations ll_file_inode_operations;
120
121 /* rw.c */
122 struct page *ll_getpage(struct inode *inode, unsigned long offset,
123                            int create, int locked);
124 void ll_truncate(struct inode *inode);
125
126 /* symlink.c */
127 extern struct inode_operations ll_fast_symlink_inode_operations;
128 extern struct inode_operations ll_symlink_inode_operations;
129
130 /* sysctl.c */
131 void ll_sysctl_init(void);
132 void ll_sysctl_clean(void);
133
134 #endif