Whamcloud - gitweb
* Change mds_client_info to mds_export_data and embed it in obd_export.
[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/obd_class.h>
21 #include <linux/lustre_net.h>
22 #include <linux/lustre_mds.h>
23 #include <linux/lustre_ha.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 struct ll_inode_md {
33         struct mds_body *body;
34         struct lov_stripe_md *md;
35 };
36
37 #define LL_IOC_GETFLAGS                 _IOR ('f', 151, long)
38 #define LL_IOC_SETFLAGS                 _IOW ('f', 152, long)
39 #define LL_IOC_CLRFLAGS                 _IOW ('f', 153, long)
40
41 #define LL_FILE_IGNORE_LOCK             0x00000001
42
43 #define LL_INLINESZ      60
44 struct ll_inode_info {
45         int              lli_flags;
46         //        struct obdo     *lli_obdo;
47         struct  lov_stripe_md *lli_smd;
48         //        int              lli_obdo_mdsz;
49         //void            *lli_obdo_md;
50         char            *lli_symlink_name;
51         char             lli_inline[LL_INLINESZ];
52         struct lustre_handle lli_intent_lock_handle;
53 };
54
55 #define LL_SUPER_MAGIC 0x0BD00BD0
56
57 #define LL_COMMITCBD_STOPPING  0x1
58 #define LL_COMMITCBD_STOPPED   0x2
59 #define LL_COMMITCBD_RUNNING   0x4
60
61 struct ll_sb_info {
62         struct lustre_handle      ll_mdc_conn;
63         struct lustre_handle      ll_osc_conn;
64         obd_id                    ll_rootino; /* number of root inode */
65
66         wait_queue_head_t         ll_commitcbd_waitq;
67         wait_queue_head_t         ll_commitcbd_ctl_waitq;
68         int                       ll_commitcbd_flags;
69         struct task_struct       *ll_commitcbd_thread;
70         time_t                    ll_commitcbd_waketime;
71         time_t                    ll_commitcbd_timeout;
72         spinlock_t                ll_commitcbd_lock;
73 };
74
75
76 static inline struct ll_sb_info *ll_s2sbi(struct super_block *sb)
77 {
78         return (struct ll_sb_info *)(sb->u.generic_sbp);
79 }
80
81 static inline struct lustre_handle *ll_s2obdconn(struct super_block *sb)
82 {
83         return &(ll_s2sbi(sb))->ll_osc_conn;
84 }
85
86 static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi)
87 {
88         struct obd_device *obd = class_conn2obd(&sbi->ll_mdc_conn);
89         if (obd == NULL)
90                 LBUG();
91         return &obd->u.cli;
92 }
93
94 static inline struct ll_sb_info *ll_i2sbi(struct inode *inode)
95 {
96         return ll_s2sbi(inode->i_sb);
97 }
98
99 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
100 {
101         return (struct ll_inode_info *)&(inode->u.generic_ip);
102 }
103
104 static inline int ll_has_inline(struct inode *inode)
105 {
106         return (ll_i2info(inode)->lli_flags & OBD_FL_INLINEDATA);
107 }
108
109
110 static inline struct lustre_handle *ll_i2obdconn(struct inode *inode)
111 {
112         return ll_s2obdconn(inode->i_sb);
113 }
114
115 static inline void ll_ino2fid(struct ll_fid *fid, obd_id ino, __u32 generation,
116                               int type)
117 {
118         fid->id = ino;
119         fid->generation = generation;
120         fid->f_type = type;
121 }
122
123 static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
124 {
125         ll_ino2fid(fid, inode->i_ino, inode->i_generation,
126                    inode->i_mode & S_IFMT);
127 }
128
129 /* namei.c */
130 int ll_lock(struct inode *dir, struct dentry *dentry,
131             struct lookup_intent *it, struct lustre_handle *lockh);
132 int ll_unlock(__u32 mode, struct lustre_handle *lockh);
133
134 /* dcache.c */
135 void ll_intent_release(struct dentry *de);
136
137 /* dir.c */
138 extern struct file_operations ll_dir_operations;
139 extern struct inode_operations ll_dir_inode_operations;
140
141 /* file.c */
142 extern struct file_operations ll_file_operations;
143 extern struct inode_operations ll_file_inode_operations;
144
145 /* rw.c */
146 struct page *ll_getpage(struct inode *inode, unsigned long offset,
147                            int create, int locked);
148 void ll_truncate(struct inode *inode);
149
150 /* symlink.c */
151 extern struct inode_operations ll_fast_symlink_inode_operations;
152 extern struct inode_operations ll_symlink_inode_operations;
153
154 /* sysctl.c */
155 void ll_sysctl_init(void);
156 void ll_sysctl_clean(void);
157
158 #endif