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