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