Whamcloud - gitweb
d6953fba719648451674ec9845f78f3750e8b216
[fs/lustre-release.git] / lustre / include / linux / lustre_fsfilt.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2001-2004 Cluster File Systems, Inc. <info@clusterfs.com>
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  * Filesystem interface helper.
22  *
23  */
24
25 #ifndef _LUSTRE_FSFILT_H
26 #define _LUSTRE_FSFILT_H
27
28 #ifdef __KERNEL__
29
30 #include <linux/obd.h>
31 #include <linux/lustre_log.h>
32 #include <linux/obd_class.h>
33
34 typedef void (*fsfilt_cb_t)(struct obd_device *obd, __u64 last_rcvd,
35                             void *data, int error);
36
37 struct fsfilt_objinfo {
38         struct dentry *fso_dentry;
39         int fso_bufcnt;
40 };
41
42 struct fsfilt_operations {
43         struct list_head fs_list;
44         struct module *fs_owner;
45         char   *fs_type;
46         void   *(* fs_start)(struct inode *inode, int op, void *desc_private,
47                              int logs);
48         void   *(* fs_brw_start)(int objcount, struct fsfilt_objinfo *fso,
49                                  int niocount, struct niobuf_local *nb,
50                                  void *desc_private, int logs);
51         int     (* fs_commit)(struct super_block *sb, struct inode *inode, 
52                               void *handle,int force_sync);
53         int     (* fs_commit_async)(struct inode *inode, void *handle,
54                                         void **wait_handle);
55         int     (* fs_commit_wait)(struct inode *inode, void *handle);
56         int     (* fs_setattr)(struct dentry *dentry, void *handle,
57                                struct iattr *iattr, int do_trunc);
58         int     (* fs_iocontrol)(struct inode *inode, struct file *file,
59                                  unsigned int cmd, unsigned long arg);
60         int     (* fs_set_md)(struct inode *inode, void *handle, void *md,
61                               int size);
62         int     (* fs_get_md)(struct inode *inode, void *md, int size);
63
64         /* this method is needed to make IO operation fsfilt nature depend. */
65 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
66         int     (* fs_send_bio)(struct inode *inode, struct bio *bio);
67 #else
68         int     (* fs_send_bio)(struct inode *inode, struct kiobuf *bio);
69 #endif
70
71         /* methods for getting page from backing fs and putting page there
72          * during IO. Used on OST. */
73         int (* fs_putpage)(struct inode *inode, struct page *page);
74         struct page *(* fs_getpage)(struct inode *inode, long int index);
75
76         ssize_t (* fs_readpage)(struct file *file, char *buf, size_t count,
77                                 loff_t *offset);
78         int     (* fs_add_journal_cb)(struct obd_device *obd, struct super_block *sb,
79                                       __u64 last_rcvd, void *handle, fsfilt_cb_t cb_func,
80                                       void *cb_data);
81         int     (* fs_statfs)(struct super_block *sb, struct obd_statfs *osfs);
82         int     (* fs_sync)(struct super_block *sb);
83         int     (* fs_map_inode_pages)(struct inode *inode, struct page **page,
84                                        int pages, unsigned long *blocks,
85                                        int *created, int create,
86                                        struct semaphore *sem);
87         int     (* fs_prep_san_write)(struct inode *inode, long *blocks,
88                                       int nblocks, loff_t newsize);
89         int     (* fs_write_record)(struct file *, void *, int size, loff_t *,
90                                     int force_sync);
91         int     (* fs_read_record)(struct file *, void *, int size, loff_t *);
92         int     (* fs_setup)(struct obd_device *, struct super_block *);
93         
94         int     (* fs_post_setup)(struct obd_device *obd, struct vfsmount *mnt);
95         int     (* fs_post_cleanup)(struct obd_device *obd, struct vfsmount *mnt);
96         int     (* fs_get_reint_log_ctxt)(struct super_block *sb, 
97                                           struct llog_ctxt **ctxt);
98         int     (* fs_set_fs_flags)(struct inode *inode, int flags);
99         int     (* fs_clear_fs_flags)(struct inode *inode, int flags);
100         int     (* fs_set_ost_flags)(struct super_block *sb);
101         int     (* fs_set_mds_flags)(struct super_block *sb);
102         int     (* fs_precreate_rec)(struct dentry *dentry, int *num, 
103                                      struct obdo *oa);
104         int     (* fs_set_xattr)(struct inode *inode, void *handle, char *name,
105                                  void *buffer, int buffer_size);
106         int     (* fs_get_xattr)(struct inode *inode, char *name,
107                                  void *buffer, int buffer_size); 
108         
109         int     (* fs_init_extents_ea)(struct inode *inode); 
110         int     (* fs_insert_extents_ea)(struct inode *inode, unsigned long from, 
111                                          unsigned long num); 
112         int     (* fs_do_write_cow)(struct dentry *dentry, void *extents, int nexts);
113         int     (* fs_write_extents)(struct dentry *dentry, 
114                                      unsigned long offset, unsigned long blks);
115         int     (* fs_get_fs_flags)(struct dentry *dentry);
116         int     (* fs_remove_extents_ea)(struct inode *inode, unsigned long from, 
117                                          unsigned long num); 
118         int     (* fs_get_ino_write_extents)(struct super_block *sb, ino_t ino, 
119                                              char **pbuf, int *size);
120         int     (* fs_free_write_extents)(struct super_block *sb, ino_t ino, 
121                                           char *pbuf, int size);
122         int     (* fs_get_inode_write_extents)(struct inode *inode, char **pbuf, 
123                                                int *size);
124         int     (* fs_get_write_extents_num)(struct inode *inode, int* size);
125
126         int     (* fs_get_op_len)(int, struct fsfilt_objinfo *, int);
127         int     (* fs_add_dir_entry)(struct obd_device *, struct dentry *,
128                                      char *, int, unsigned long, unsigned long,
129                                      unsigned);
130         int     (* fs_del_dir_entry)(struct obd_device *, struct dentry *);
131         /*snap operations*/
132         int     (* fs_is_redirector)(struct inode *inode);
133         int     (* fs_is_indirect)(struct inode *inode);
134         
135         struct inode * (* fs_create_indirect)(struct inode *pri, int index,
136                                               unsigned int gen, struct inode *parent,
137                                               int del);
138         struct inode * (* fs_get_indirect)(struct inode *pri, int *table,
139                                           int slot);
140         ino_t   (* fs_get_indirect_ino)(struct inode *pri, int index);
141         int     (* fs_destroy_indirect)(struct inode *pri, int index,
142                                         struct inode *next_ind);
143         int     (* fs_restore_indirect)(struct inode *pri, int index);
144         int     (* fs_iterate)(struct super_block *sb,
145                               int (*repeat)(struct inode *inode, void *priv),
146                               struct inode **start, void *priv, int flag);
147         int     (* fs_copy_block)(struct inode *dst, struct inode *src, int blk);
148         int     (* fs_set_indirect)(struct inode *pri, int index,
149                                     ino_t ind_ino, ino_t parent_ino);
150         int     (* fs_snap_feature)(struct super_block *sb, int feature, int op);
151         int     (* fs_set_snap_info)(struct super_block *sb, struct inode *inode, 
152                                      void* key, __u32 keylen, void *val, 
153                                      __u32 *vallen); 
154         int     (* fs_get_snap_info)(struct super_block *sb, struct inode *inode,
155                                      void* key, __u32 keylen, void *val, 
156                                      __u32 *vallen); 
157         int     (* fs_set_snap_item)(struct super_block *sb, char *name);
158 };
159
160 extern int fsfilt_register_ops(struct fsfilt_operations *fs_ops);
161 extern void fsfilt_unregister_ops(struct fsfilt_operations *fs_ops);
162 extern struct fsfilt_operations *fsfilt_get_ops(const char *type);
163 extern void fsfilt_put_ops(struct fsfilt_operations *fs_ops);
164
165 #define FSFILT_OP_UNLINK         1
166 #define FSFILT_OP_RMDIR          2
167 #define FSFILT_OP_RENAME         3
168 #define FSFILT_OP_CREATE         4
169 #define FSFILT_OP_MKDIR          5
170 #define FSFILT_OP_SYMLINK        6
171 #define FSFILT_OP_MKNOD          7
172 #define FSFILT_OP_SETATTR        8
173 #define FSFILT_OP_LINK           9
174 #define FSFILT_OP_CANCEL_UNLINK 10
175 #define FSFILT_OP_NOOP          15
176
177 /* XXX BUG 3188 -- must return to one set of opcodes */
178 #define KML_UNLINK              0x11
179 #define KML_RMDIR               0x12
180 #define KML_RENAME              0x13
181 #define KML_CREATE              0x14
182 #define KML_MKDIR               0x15
183 #define KML_SYMLINK             0x16
184 #define KML_MKNOD               0x17
185 #define KML_LINK                0x19
186
187 #define CACHE_UNLINK            0x21
188 #define CACHE_RMDIR             0x22
189 #define CACHE_RENAME            0x23
190 #define CACHE_CREATE            0x24
191 #define CACHE_MKDIR             0x25
192 #define CACHE_SYMLINK           0x26
193 #define CACHE_MKNOD             0x27
194 #define CACHE_LINK              0x29
195 #define CACHE_NOOP              0x2f
196
197 #define KML_CACHE_UNLINK        0x31
198 #define KML_CACHE_RMDIR         0x32
199 #define KML_CACHE_RENAME        0x33
200 #define KML_CACHE_CREATE        0x34
201 #define KML_CACHE_MKDIR         0x35
202 #define KML_CACHE_SYMLINK       0x36
203 #define KML_CACHE_MKNOD         0x37
204 #define KML_CACHE_LINK          0x39
205 #define KML_CACHE_NOOP          0x3f
206
207 /*for fsfilt set md ea*/
208 #define LMV_EA  1
209 #define LOV_EA  0
210
211 static inline void *
212 fsfilt_start_ops(struct fsfilt_operations *ops, struct inode *inode,
213                  int op, struct obd_trans_info *oti, int logs)
214 {
215         unsigned long now = jiffies;
216         void *parent_handle = oti ? oti->oti_handle : NULL;
217         void *handle = ops->fs_start(inode, op, parent_handle, logs);
218         CDEBUG(D_INFO, "started handle %p (%p)\n", handle, parent_handle);
219
220         if (oti != NULL) {
221                 if (parent_handle == NULL) {
222                         oti->oti_handle = handle;
223                 } else if (handle != parent_handle) {
224                         CERROR("mismatch: parent %p, handle %p, oti %p\n",
225                                parent_handle, handle, oti);
226                         LBUG();
227                 }
228         }
229         if (time_after(jiffies, now + 15 * HZ))
230                 CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
231         return handle;
232 }
233
234 static inline void *
235 fsfilt_start_log(struct obd_device *obd, struct inode *inode,
236                  int op, struct obd_trans_info *oti, int logs)
237 {
238         return fsfilt_start_ops(obd->obd_fsops, inode, op, oti, logs);
239 }
240
241 static inline void *
242 fsfilt_start(struct obd_device *obd, struct inode *inode,
243              int op, struct obd_trans_info *oti)
244 {
245         return fsfilt_start_ops(obd->obd_fsops, inode, op, oti, 0);
246 }
247
248 static inline void *
249 llog_fsfilt_start(struct llog_ctxt *ctxt, struct inode *inode,
250                   int op, struct obd_trans_info *oti)
251 {
252         return fsfilt_start_ops(ctxt->loc_fsops, inode, op, oti, 1);
253 }
254
255 static inline int
256 fsfilt_commit_ops(struct fsfilt_operations *ops, struct super_block *sb,
257                   struct inode *inode, void *handle, int force_sync)
258 {
259         unsigned long now = jiffies;
260         int rc = ops->fs_commit(sb, inode, handle, force_sync);
261         CDEBUG(D_INFO, "committing handle %p\n", handle);
262
263         if (time_after(jiffies, now + 15 * HZ))
264                 CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
265
266         return rc;
267 }
268
269 static inline int
270 fsfilt_commit(struct obd_device *obd, struct super_block *sb, 
271               struct inode *inode, void *handle, int force_sync)
272 {
273         return fsfilt_commit_ops(obd->obd_fsops, sb, inode, handle, force_sync);
274 }
275
276 static inline int
277 llog_fsfilt_commit(struct llog_ctxt *ctxt, struct inode *inode,
278                    void *handle, int force_sync)
279 {
280         return fsfilt_commit_ops(ctxt->loc_fsops, inode->i_sb, inode, handle, 
281                                  force_sync);
282 }
283
284 static inline void *
285 fsfilt_brw_start_log(struct obd_device *obd, int objcount,
286                      struct fsfilt_objinfo *fso, int niocount,
287                      struct niobuf_local *nb, struct obd_trans_info *oti,
288                      int logs)
289 {
290         unsigned long now = jiffies;
291         void *parent_handle = oti ? oti->oti_handle : NULL;
292         void *handle = obd->obd_fsops->fs_brw_start(objcount, fso, niocount, nb,
293                                                     parent_handle, logs);
294         CDEBUG(D_INFO, "started handle %p (%p)\n", handle, parent_handle);
295
296         if (oti != NULL) {
297                 if (parent_handle == NULL) {
298                         oti->oti_handle = handle;
299                 } else if (handle != parent_handle) {
300                         CERROR("mismatch: parent %p, handle %p, oti %p\n",
301                                parent_handle, handle, oti);
302                         LBUG();
303                 }
304         }
305         if (time_after(jiffies, now + 15 * HZ))
306                 CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
307
308         return handle;
309 }
310
311 static inline void *
312 fsfilt_brw_start(struct obd_device *obd, int objcount,
313                  struct fsfilt_objinfo *fso, int niocount,
314                  struct niobuf_local *nb, struct obd_trans_info *oti)
315 {
316         return fsfilt_brw_start_log(obd, objcount, fso, niocount, nb, oti, 0);
317 }
318
319 static inline int
320 fsfilt_commit_async(struct obd_device *obd, struct inode *inode,
321                     void *handle, void **wait_handle)
322 {
323         unsigned long now = jiffies;
324         int rc = obd->obd_fsops->fs_commit_async(inode, handle, wait_handle);
325
326         CDEBUG(D_INFO, "committing handle %p (async)\n", *wait_handle);
327         if (time_after(jiffies, now + 15 * HZ))
328                 CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
329
330         return rc;
331 }
332
333 static inline int
334 fsfilt_commit_wait(struct obd_device *obd, struct inode *inode, void *handle)
335 {
336         unsigned long now = jiffies;
337         int rc = obd->obd_fsops->fs_commit_wait(inode, handle);
338         CDEBUG(D_INFO, "waiting for completion %p\n", handle);
339         if (time_after(jiffies, now + 15 * HZ))
340                 CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
341         return rc;
342 }
343
344 static inline int
345 fsfilt_setattr(struct obd_device *obd, struct dentry *dentry,
346                void *handle, struct iattr *iattr, int do_trunc)
347 {
348         unsigned long now = jiffies;
349         int rc;
350         rc = obd->obd_fsops->fs_setattr(dentry, handle, iattr, do_trunc);
351         if (time_after(jiffies, now + 15 * HZ))
352                 CERROR("long setattr time %lus\n", (jiffies - now) / HZ);
353         return rc;
354 }
355
356 static inline int
357 fsfilt_iocontrol(struct obd_device *obd, struct inode *inode,
358                  struct file *file, unsigned int cmd,
359                  unsigned long arg)
360 {
361         return obd->obd_fsops->fs_iocontrol(inode, file, cmd, arg);
362 }
363
364 static inline int fsfilt_setup(struct obd_device *obd,
365                                struct super_block *fs)
366 {
367         if (obd->obd_fsops->fs_setup)
368                 return obd->obd_fsops->fs_setup(obd, fs);
369         return 0;
370 }
371 static inline int
372 fsfilt_set_md(struct obd_device *obd, struct inode *inode,
373               void *handle, void *md, int size)
374 {
375         return obd->obd_fsops->fs_set_md(inode, handle, md, size);
376 }
377
378 static inline int
379 fsfilt_get_md(struct obd_device *obd, struct inode *inode,
380               void *md, int size)
381 {
382         return obd->obd_fsops->fs_get_md(inode, md, size);
383 }
384
385 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
386 static inline int
387 fsfilt_send_bio(struct obd_device *obd, struct inode *inode,
388                 struct bio *bio)
389 #else
390 static inline int
391 fsfilt_send_bio(struct obd_device *obd, struct inode *inode,
392                 struct kiobuf *bio)
393 #endif
394 {
395         return obd->obd_fsops->fs_send_bio(inode, bio);
396 }
397
398 static inline int
399 fsfilt_putpage(struct obd_device *obd, struct inode *inode,
400                struct page *page)
401 {
402         int rc = 0;
403         struct filter_obd *filter;
404         unsigned long now = jiffies;
405
406         LASSERT(obd != NULL);
407         LASSERT(inode != NULL);
408         LASSERT(page != NULL);
409
410         filter = &obd->u.filter;
411
412         if (!obd->obd_fsops->fs_putpage)
413                 return -ENOSYS;
414
415         CDEBUG(D_INFO, "putpage %lx\n", page->index);
416
417         rc = obd->obd_fsops->fs_putpage(inode, page);
418
419         if (time_after(jiffies, now + 15 * HZ))
420                 CERROR("long putpage time %lus\n", (jiffies - now) / HZ);
421
422         return rc;
423 }
424
425 static inline struct page *
426 fsfilt_getpage(struct obd_device *obd, struct inode *inode,
427                unsigned long index)
428 {
429         struct page *page;
430         unsigned long now = jiffies;
431
432         LASSERT(obd != NULL);
433         LASSERT(inode != NULL);
434
435         if (!obd->obd_fsops->fs_getpage)
436                 return ERR_PTR(-ENOSYS);
437
438         CDEBUG(D_INFO, "getpage %lx\n", index);
439
440         page = obd->obd_fsops->fs_getpage(inode, index);
441
442         if (time_after(jiffies, now + 15 * HZ))
443                 CERROR("long getpage time %lus\n", (jiffies - now) / HZ);
444
445         return page;
446 }
447
448 static inline ssize_t
449 fsfilt_readpage(struct obd_device *obd, struct file *file, char *buf,
450                 size_t count, loff_t *offset)
451 {
452         return obd->obd_fsops->fs_readpage(file, buf, count, offset);
453 }
454
455 static inline int
456 fsfilt_add_journal_cb(struct obd_device *obd, struct super_block *sb,
457                       __u64 last_rcvd, void *handle, fsfilt_cb_t cb_func,
458                       void *cb_data)
459 {
460         return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_rcvd, handle,
461                                                  cb_func, cb_data);
462 }
463
464 /* very similar to obd_statfs(), but caller already holds obd_osfs_lock */
465 static inline int
466 fsfilt_statfs(struct obd_device *obd, struct super_block *sb,
467               unsigned long max_age)
468 {
469         int rc = 0;
470
471         CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age);
472         if (time_before(obd->obd_osfs_age, max_age)) {
473                 rc = obd->obd_fsops->fs_statfs(sb, &obd->obd_osfs);
474                 if (rc == 0) /* N.B. statfs can't really fail */
475                         obd->obd_osfs_age = jiffies;
476         } else {
477                 CDEBUG(D_SUPER, "using cached obd_statfs data\n");
478         }
479
480         return rc;
481 }
482
483 static inline int
484 fsfilt_sync(struct obd_device *obd, struct super_block *sb)
485 {
486         return obd->obd_fsops->fs_sync(sb);
487 }
488
489 static inline int fsfilt_map_inode_pages(struct obd_device *obd,
490                                          struct inode *inode,
491                                          struct page **page, int pages,
492                                          unsigned long *blocks, int *created,
493                                          int create, struct semaphore *sem)
494 {
495         return obd->obd_fsops->fs_map_inode_pages(inode, page, pages, blocks,
496                                                   created, create, sem);
497 }
498 static inline int fsfilt_get_fs_flags(struct obd_device *obd, 
499                                       struct dentry *dentry)
500 {
501         if (obd->obd_fsops->fs_get_fs_flags) 
502                 return obd->obd_fsops->fs_get_fs_flags(dentry);
503         return 0;
504 }
505
506 static inline int 
507 fsfilt_write_extents(struct obd_device *obd, struct dentry *dentry, 
508                      unsigned long offset, unsigned long blks)
509 {
510         if (obd->obd_fsops->fs_write_extents)
511                 return obd->obd_fsops->fs_write_extents(dentry, 
512                                                         offset, blks);
513         return 0;
514 }
515 static inline int
516 fsfilt_do_write_cow(struct obd_device *obd, struct dentry *dentry,
517                     void *extents, int num_extents)
518 {
519         if (obd->obd_fsops->fs_do_write_cow)
520                 return obd->obd_fsops->fs_do_write_cow(dentry, extents,
521                                                        num_extents);
522         return 0;
523 }
524 static inline int
525 fs_prep_san_write(struct obd_device *obd, struct inode *inode,
526                   long *blocks, int nblocks, loff_t newsize)
527 {
528         return obd->obd_fsops->fs_prep_san_write(inode, blocks,
529                                                  nblocks, newsize);
530 }
531
532 static inline int
533 fsfilt_read_record(struct obd_device *obd, struct file *file,
534                    void *buf, loff_t size, loff_t *offs)
535 {
536         return obd->obd_fsops->fs_read_record(file, buf, size, offs);
537 }
538
539 static inline int 
540 llog_fsfilt_read_record(struct llog_ctxt *ctxt, struct file *file, 
541                         void *buf, loff_t size, loff_t *offs)
542 {
543         return ctxt->loc_fsops->fs_read_record(file, buf, size, offs);
544 }
545
546 static inline int
547 fsfilt_write_record(struct obd_device *obd, struct file *file,
548                     void *buf, loff_t size, loff_t *offs, int force_sync)
549 {
550         return obd->obd_fsops->fs_write_record(file, buf, size, offs,
551                                                force_sync);
552 }
553
554 static inline int
555 llog_fsfilt_write_record(struct llog_ctxt *ctxt, struct file *file,
556                          void *buf, loff_t size, loff_t *offs,
557                          int force_sync)
558 {
559         return ctxt->loc_fsops->fs_write_record(file, buf, size, offs,
560                                                 force_sync);
561 }
562
563 static inline int 
564 fsfilt_set_fs_flags(struct obd_device *obd, struct inode *inode, int flags)
565 {
566         if (obd->obd_fsops->fs_set_fs_flags)
567                 return obd->obd_fsops->fs_set_fs_flags(inode, flags);
568         return 0;
569 }
570
571 static inline int 
572 fsfilt_clear_fs_flags(struct obd_device *obd, struct inode *inode, int flags)
573 {
574         if (obd->obd_fsops->fs_clear_fs_flags)
575                 return obd->obd_fsops->fs_clear_fs_flags(inode, flags);
576         return 0;
577 }
578 static inline int 
579 fsfilt_precreate_rec(struct obd_device *obd, struct dentry *dentry,
580                      int *num, struct obdo *oa)
581 {
582         if (obd->obd_fsops->fs_precreate_rec)
583                 return obd->obd_fsops->fs_precreate_rec(dentry, num, oa);
584         return 0;
585 }
586
587 static inline int 
588 fsfilt_post_setup(struct obd_device *obd)
589 {
590         if (obd->obd_fsops->fs_post_setup)
591                 return obd->obd_fsops->fs_post_setup(obd, 
592                                 obd->obd_lvfs_ctxt.pwdmnt);
593         return 0;
594 }
595
596 static inline int 
597 fsfilt_post_cleanup(struct obd_device *obd)
598 {
599         if (obd->obd_fsops->fs_post_cleanup)
600                 return obd->obd_fsops->fs_post_cleanup(obd, 
601                                 obd->obd_lvfs_ctxt.pwdmnt);
602         return 0;
603 }
604
605 static inline int 
606 fsfilt_get_ino_write_extents(struct obd_device *obd, 
607                              struct super_block *sb, 
608                              int ino, char **buf, int *size)
609 {
610         if (obd->obd_fsops->fs_get_ino_write_extents)
611                 return obd->obd_fsops->fs_get_ino_write_extents(sb, ino, 
612                                                                 buf, size);
613         return 0;
614 }
615
616 static inline int 
617 fsfilt_free_write_extents(struct obd_device *obd, 
618                           struct super_block *sb, 
619                           int ino, char *buf, int size)
620 {
621         if (obd->obd_fsops->fs_free_write_extents)
622                 return obd->obd_fsops->fs_free_write_extents(sb, ino, 
623                                                              buf, size);
624         return 0;
625 }
626
627 static inline int 
628 fsfilt_get_reint_log_ctxt(struct obd_device *obd,
629                           struct super_block *sb, 
630                           struct llog_ctxt **ctxt)
631 {
632         if (obd->obd_fsops->fs_get_reint_log_ctxt)
633                 return obd->obd_fsops->fs_get_reint_log_ctxt(sb, ctxt);
634         return 0;
635 }
636
637 static inline int 
638 fsfilt_set_ost_flags(struct obd_device *obd, struct super_block *sb) 
639 {
640         if (obd->obd_fsops->fs_set_ost_flags)
641                 return obd->obd_fsops->fs_set_ost_flags(sb);
642         return 0;
643 }
644
645 static inline int 
646 fsfilt_set_mds_flags(struct obd_device *obd, struct super_block *sb) 
647 {
648         if (obd->obd_fsops->fs_set_mds_flags)
649                 return obd->obd_fsops->fs_set_mds_flags(sb);
650         return 0;
651 }
652
653 static inline int 
654 fsfilt_add_dir_entry(struct obd_device *obd, struct dentry *dir,
655                      char *name, int namelen, unsigned long ino,
656                      unsigned long generation, unsigned mds)
657 {
658         LASSERT(obd->obd_fsops->fs_add_dir_entry);
659         return obd->obd_fsops->fs_add_dir_entry(obd, dir, name,
660                                                 namelen, ino, generation, mds);
661 }
662
663 static inline int 
664 fsfilt_del_dir_entry(struct obd_device *obd, struct dentry *dentry)
665 {
666         LASSERT(obd->obd_fsops->fs_del_dir_entry);
667         return obd->obd_fsops->fs_del_dir_entry(obd, dentry);
668 }
669
670 static inline int 
671 fsfilt_set_snap_item(struct obd_device *obd, struct super_block *sb,
672                      char *name)
673 {
674          if (obd->obd_fsops->fs_set_snap_item)
675                 return obd->obd_fsops->fs_set_snap_item(sb, name);
676         return 0;
677
678 #endif /* __KERNEL__ */
679
680 #endif