Whamcloud - gitweb
- Added an 'xid' field to struct niobuf
[fs/lustre-release.git] / lustre / include / linux / lustre_light.h
1 /* object based disk file system
2  * 
3  * This code is issued under the GNU General Public License.
4  * See the file COPYING in this distribution
5  * 
6  * Copyright (C), 1999, Stelias Computing Inc
7  *
8  *
9  */
10
11
12 #ifndef _LL_H
13 #define _LL_H
14 #include <linux/obd_class.h>
15 #include <linux/obdo.h>
16 #include <linux/list.h>
17 #include <linux/lustre_net.h>
18
19 #define LL_SUPER_MAGIC 0x0BD00BD0;
20
21 #define LL_INLINESZ      60
22 struct ll_inode_info {
23         int              lli_flags;
24         __u64            lli_objid; 
25         char             lli_inline[LL_INLINESZ];
26 };
27
28 struct ll_sb_info {
29         struct list_head         ll_list;      /* list of supers */
30         struct obd_conn          ll_conn;
31         struct super_block      *ll_super;
32         ino_t                       ll_rootino;   /* number of root inode */
33         int                        ll_minor;     /* minor of /dev/obdX */
34         struct list_head         ll_inodes;    /* list of dirty inodes */
35         unsigned long          ll_cache_count;
36         struct semaphore         ll_list_mutex;
37         struct ptlrpc_client     ll_mds_client;
38         struct ptlrpc_client     ll_ost_client;
39 };
40
41
42 static inline struct ll_sb_info *ll_i2sbi(struct inode *inode)
43 {
44         return (struct ll_sb_info *) (inode->i_sb->u.generic_sbp);
45 }
46
47 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
48 {
49         return (struct ll_inode_info *)&(inode->u.generic_ip);
50 }
51
52 static inline int ll_has_inline(struct inode *inode)
53 {
54         return (ll_i2info(inode)->lli_flags & OBD_FL_INLINEDATA);
55 }
56
57
58 static inline struct obd_conn *ll_i2obdconn(struct inode *inode)
59 {
60         return &(ll_i2sbi(inode))->ll_conn;
61 }
62
63
64
65
66
67 /* super.c */ 
68 struct ll_pgrq {
69         struct list_head         rq_plist;      /* linked list of req's */
70         unsigned long            rq_jiffies;
71         struct page             *rq_page;       /* page to be written */
72 };
73
74 extern struct list_head ll_super_list;       /* list of all LL superblocks */
75
76
77
78 /* dir.c */
79 #define EXT2_DIR_PAD                    4
80 #define EXT2_DIR_ROUND                  (EXT2_DIR_PAD - 1)
81 #define EXT2_DIR_REC_LEN(name_len)      (((name_len) + 8 + EXT2_DIR_ROUND) & \
82                                          ~EXT2_DIR_ROUND)
83 #define EXT2_NAME_LEN 255
84
85 int ll_check_dir_entry (const char * function, struct inode * dir,
86                           struct ext2_dir_entry_2 * de, struct page * page,
87                           unsigned long offset);
88 extern struct file_operations ll_dir_operations;
89 extern struct inode_operations ll_dir_inode_operations;
90
91 /* file.c */
92 extern struct file_operations ll_file_operations;
93 extern struct inode_operations ll_file_inode_operations;
94
95 /* flush.c */
96 void ll_dequeue_pages(struct inode *inode);
97 int ll_flushd_init(void);
98 int ll_flushd_cleanup(void);
99 int ll_flush_reqs(struct list_head *inode_list, unsigned long check_time);
100 int ll_flush_dirty_pages(unsigned long check_time);
101
102 /* namei.c */
103 /*
104  * Structure of the super block
105  */
106
107
108 #define EXT2_SB(sb)     (&((sb)->u.ext2_sb))
109 /*
110  * Maximal count of links to a file
111  */
112 #define EXT2_LINK_MAX           32000
113 /*
114  * Ext2 directory file types.  Only the low 3 bits are used.  The
115  * other bits are reserved for now.
116  */
117 #define EXT2_FT_UNKNOWN         0
118 #define EXT2_FT_REG_FILE        1
119 #define EXT2_FT_DIR             2
120 #define EXT2_FT_CHRDEV          3
121 #define EXT2_FT_BLKDEV          4
122 #define EXT2_FT_FIFO            5
123 #define EXT2_FT_SOCK            6
124 #define EXT2_FT_SYMLINK         7
125
126 #define EXT2_FT_MAX             8
127
128 #define EXT2_BTREE_FL                   0x00001000 /* btree format dir */
129 #define EXT2_RESERVED_FL                0x80000000 /* reserved for ext2 lib */
130 #define EXT2_FEATURE_INCOMPAT_FILETYPE          0x0002
131 #define EXT2_HAS_COMPAT_FEATURE(sb,mask)                        \
132         ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
133 #define EXT2_HAS_INCOMPAT_FEATURE(sb,mask)                      \
134         ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
135
136 /* rw.c */
137 int ll_do_writepage(struct page *, int sync);
138 int ll_init_pgrqcache(void);
139 void ll_cleanup_pgrqcache(void);
140 inline void ll_pgrq_del(struct ll_pgrq *pgrq);
141 int ll_readpage(struct file *file, struct page *page);
142 int ll_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to);
143 int ll_commit_write(struct file *file, struct page *page, unsigned from, unsigned to);
144 int ll_writepage(struct page *page);
145 struct page *ll_getpage(struct inode *inode, unsigned long offset,
146                            int create, int locked);
147 int ll_write_one_page(struct file *file, struct page *page,
148                          unsigned long offset, unsigned long bytes,
149                          const char * buf);
150 int ll_do_vec_wr(struct inode **inodes, obd_count num_io, obd_count num_oa,
151                     struct obdo **obdos, obd_count *oa_bufs,
152                     struct page **pages, char **bufs, obd_size *counts,
153                     obd_off *offsets, obd_flag *flags);
154 void ll_truncate(struct inode *inode);
155
156 /* super.c */
157 extern long ll_cache_count;
158 extern long ll_mutex_start;
159
160 /* symlink.c */
161 extern struct inode_operations ll_fast_symlink_inode_operations;
162 extern struct inode_operations ll_symlink_inode_operations;
163
164 /* sysctl.c */
165 void ll_sysctl_init(void);
166 void ll_sysctl_clean(void);
167
168
169
170 static inline struct list_head *ll_slist(struct inode *inode) 
171 {
172         struct ll_sb_info *sbi = ll_i2sbi(inode);
173
174         return &sbi->ll_inodes;
175 }
176
177 #endif
178