Whamcloud - gitweb
merge b_devel into HEAD, which will become 0.7.3
[fs/lustre-release.git] / lustre / llite / llite_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2003 Cluster File Systems, Inc.
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  */
9
10 #ifndef LLITE_INTERNAL_H
11 #define LLITE_INTERNAL_H
12
13
14 struct ll_sb_info;
15 struct lustre_handle;
16 struct lov_stripe_md;
17
18 extern void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
19 extern struct proc_dir_entry *proc_lustre_fs_root;
20
21 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
22 # define hlist_del_init list_del_init
23 #endif 
24
25 static inline struct inode *ll_info2i(struct ll_inode_info *lli)
26 {
27 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
28         return &lli->lli_vfs_inode;
29 #else
30         return list_entry(lli, struct inode, u.generic_ip);
31 #endif
32 }
33
34 /* llite/commit_callback.c */
35 int ll_commitcbd_setup(struct ll_sb_info *);
36 int ll_commitcbd_cleanup(struct ll_sb_info *);
37
38 /* lproc_llite.c */
39 int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
40                                 struct super_block *sb, char *osc, char *mdc);
41 void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
42
43 /* llite/namei.c */
44 struct inode *ll_iget(struct super_block *sb, ino_t hash,
45                       struct lustre_md *lic);
46 struct dentry *ll_find_alias(struct inode *, struct dentry *);
47 int ll_it_open_error(int phase, struct lookup_intent *it);
48 int ll_mdc_cancel_unused(struct lustre_handle *conn, struct inode *inode,
49                          int flags, void *opaque);
50
51 /* llite/rw.c */
52 void ll_end_writeback(struct inode *, struct page *);
53
54 void ll_remove_dirty(struct inode *inode, unsigned long start,
55                      unsigned long end);
56 int ll_rd_dirty_pages(char *page, char **start, off_t off, int count,
57                       int *eof, void *data);
58 int ll_rd_max_dirty_pages(char *page, char **start, off_t off, int count,
59                           int *eof, void *data);
60 int ll_wr_max_dirty_pages(struct file *file, const char *buffer,
61                           unsigned long count, void *data);
62 int ll_clear_dirty_pages(struct lustre_handle *conn, struct lov_stripe_md *lsm,
63                          unsigned long start, unsigned long end);
64 int ll_mark_dirty_page(struct lustre_handle *conn, struct lov_stripe_md *lsm,
65                        unsigned long index);
66
67 /* llite/file.c */
68 extern int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *);
69
70 /* llite/super.c */
71 int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc);
72 int ll_setattr(struct dentry *de, struct iattr *attr);
73
74 /* iod.c */
75 #define IO_STAT_ADD(FIS, STAT, VAL) do {        \
76         struct file_io_stats *_fis_ = (FIS);    \
77         spin_lock(&_fis_->fis_lock);            \
78         _fis_->fis_##STAT += VAL;               \
79         spin_unlock(&_fis_->fis_lock);          \
80 } while (0)
81
82 #define INODE_IO_STAT_ADD(INODE, STAT, VAL)        \
83         IO_STAT_ADD(&ll_i2sbi(INODE)->ll_iostats, STAT, VAL)
84
85 #define PAGE_IO_STAT_ADD(PAGE, STAT, VAL)               \
86         INODE_IO_STAT_ADD((PAGE)->mapping, STAT, VAL)
87
88 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
89 /* XXX lliod needs more work in 2.5 before being proven and brought back
90  * to 2.4, it'll at least require a patch to introduce page->private */
91 int lliod_start(struct ll_sb_info *sbi, struct inode *inode);
92 void lliod_stop(struct ll_sb_info *sbi);
93 #else
94 #define lliod_start(sbi, inode) ({int _ret = 0; (void)sbi, (void)inode; _ret;})
95 #define lliod_stop(sbi) do { (void)sbi; } while (0)
96 #endif
97 void lliod_wakeup(struct inode *inode);
98 void lliod_give_plist(struct inode *inode, struct plist *plist, int rw);
99 void lliod_give_page(struct inode *inode, struct page *page, int rw);
100 void plist_init(struct plist *plist); /* for lli initialization.. */
101
102 void ll_lldo_init(struct ll_dirty_offsets *lldo);
103 void ll_record_dirty(struct inode *inode, unsigned long offset);
104 void ll_remove_dirty(struct inode *inode, unsigned long start,
105                      unsigned long end);
106 int ll_find_dirty(struct ll_dirty_offsets *lldo, unsigned long *start,
107                   unsigned long *end);
108 int ll_farthest_dirty(struct ll_dirty_offsets *lldo, unsigned long *farthest);
109
110
111 /* llite/super25.c */
112 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
113 int ll_getattr(struct vfsmount *mnt, struct dentry *de,
114                struct lookup_intent *it, 
115                struct kstat *stat);
116 #endif
117
118
119 /* llite/dcache.c */
120 void ll_intent_release(struct lookup_intent *);
121 extern void ll_set_dd(struct dentry *de);
122 void ll_unhash_aliases(struct inode *);
123
124 /* llite/rw.c */
125 void ll_truncate(struct inode *inode);
126 void ll_end_writeback(struct inode *inode, struct page *page);
127 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
128 int ll_check_dirty(struct super_block *sb);
129 int ll_batch_writepage(struct inode *inode, struct obdo *oa, struct page *page);
130 #else
131 #define ll_check_dirty(SB) do { (void)SB; } while (0)
132 #endif
133
134 /* llite/llite_lib.c */
135
136 extern struct super_operations ll_super_operations;
137
138 char *ll_read_opt(const char *opt, char *data);
139 int ll_set_opt(const char *opt, char *data, int fl);
140 void ll_options(char *options, char **ost, char **mds, int *flags);
141 void ll_lli_init(struct ll_inode_info *lli);
142 int ll_fill_super(struct super_block *sb, void *data, int silent);
143 void ll_put_super(struct super_block *sb);
144 void ll_clear_inode(struct inode *inode);
145 int ll_attr2inode(struct inode *inode, struct iattr *attr, int trunc);
146 int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc);
147 int ll_setattr_raw(struct inode *inode, struct iattr *attr);
148 int ll_setattr(struct dentry *de, struct iattr *attr);
149 int ll_statfs(struct super_block *sb, struct kstatfs *sfs);
150 void ll_update_inode(struct inode *inode, struct mds_body *body,
151                      struct lov_stripe_md *lsm);
152 int it_disposition(struct lookup_intent *it, int flag);
153 void it_set_disposition(struct lookup_intent *it, int flag);
154 void ll_read_inode2(struct inode *inode, void *opaque);
155 void ll_umount_begin(struct super_block *sb);
156
157
158
159 #endif /* LLITE_INTERNAL_H */