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