Whamcloud - gitweb
- unland b_fid to HEAD
[fs/lustre-release.git] / lustre / include / linux / lustre_fsfilt.h
index 204004e..0287964 100644 (file)
@@ -58,15 +58,11 @@ struct fsfilt_operations {
         int     (* fs_iocontrol)(struct inode *inode, struct file *file,
                                  unsigned int cmd, unsigned long arg);
         int     (* fs_set_md)(struct inode *inode, void *handle, void *md,
-                              int size, int flags);
-        int     (* fs_get_md)(struct inode *inode, void *md, int size, int flags);
+                              int size);
+        int     (* fs_get_md)(struct inode *inode, void *md, int size);
 
         /* this method is needed to make IO operation fsfilt nature depend. */
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-        int     (* fs_send_bio)(struct inode *inode, struct bio *bio);
-#else
-        int     (* fs_send_bio)(struct inode *inode, struct kiobuf *bio);
-#endif
+        int     (* fs_send_bio)(int rw, struct inode *inode,struct kiobuf *bio);
 
         /* methods for getting page from backing fs and putting page there
          * during IO. Used on OST. */
@@ -75,8 +71,10 @@ struct fsfilt_operations {
 
         ssize_t (* fs_readpage)(struct file *file, char *buf, size_t count,
                                 loff_t *offset);
-        int     (* fs_add_journal_cb)(struct obd_device *obd, struct super_block *sb,
-                                      __u64 last_rcvd, void *handle, fsfilt_cb_t cb_func,
+        int     (* fs_add_journal_cb)(struct obd_device *obd, 
+                                      struct super_block *sb,
+                                      __u64 last_rcvd, void *handle, 
+                                      fsfilt_cb_t cb_func,
                                       void *cb_data);
         int     (* fs_statfs)(struct super_block *sb, struct obd_statfs *osfs);
         int     (* fs_sync)(struct super_block *sb);
@@ -91,12 +89,13 @@ struct fsfilt_operations {
         int     (* fs_read_record)(struct file *, void *, int size, loff_t *);
         int     (* fs_setup)(struct obd_device *, struct super_block *);
         
-        int     (* fs_post_setup)(struct obd_device *obd, struct vfsmount *mnt);
+        int     (* fs_post_setup)(struct obd_device *obd, struct vfsmount *mnt,
+                                  struct dentry *dentry);
         int     (* fs_post_cleanup)(struct obd_device *obd, struct vfsmount *mnt);
         int     (* fs_get_reint_log_ctxt)(struct super_block *sb, 
                                           struct llog_ctxt **ctxt);
-        int     (* fs_set_kml_flags)(struct inode *inode);
-        int     (* fs_clear_kml_flags)(struct inode *inode);
+        int     (* fs_set_fs_flags)(struct inode *inode, int flags);
+        int     (* fs_clear_fs_flags)(struct inode *inode, int flags);
         int     (* fs_set_ost_flags)(struct super_block *sb);
         int     (* fs_set_mds_flags)(struct super_block *sb);
         int     (* fs_precreate_rec)(struct dentry *dentry, int *num, 
@@ -109,8 +108,10 @@ struct fsfilt_operations {
         int     (* fs_init_extents_ea)(struct inode *inode); 
         int     (* fs_insert_extents_ea)(struct inode *inode, unsigned long from, 
                                          unsigned long num); 
+        int     (* fs_do_write_cow)(struct dentry *dentry, void *extents, int nexts);
         int     (* fs_write_extents)(struct dentry *dentry, 
                                      unsigned long offset, unsigned long blks);
+        int     (* fs_get_fs_flags)(struct dentry *dentry);
         int     (* fs_remove_extents_ea)(struct inode *inode, unsigned long from, 
                                          unsigned long num); 
         int     (* fs_get_ino_write_extents)(struct super_block *sb, ino_t ino, 
@@ -131,27 +132,36 @@ struct fsfilt_operations {
         int     (* fs_is_indirect)(struct inode *inode);
         
         struct inode * (* fs_create_indirect)(struct inode *pri, int index,
-                                              unsigned int gen, struct inode *parent,
+                                              unsigned int gen, 
+                                              struct inode *parent,
                                               int del);
         struct inode * (* fs_get_indirect)(struct inode *pri, int *table,
                                           int slot);
-        ino_t   (* fs_get_indirect_ino)(struct inode *pri, int index);
+        ino_t   (* fs_get_indirect_ino)(struct super_block *sb, ino_t pri, 
+                                        int index);
         int     (* fs_destroy_indirect)(struct inode *pri, int index,
                                         struct inode *next_ind);
         int     (* fs_restore_indirect)(struct inode *pri, int index);
         int     (* fs_iterate)(struct super_block *sb,
                               int (*repeat)(struct inode *inode, void *priv),
                               struct inode **start, void *priv, int flag);
-        int     (* fs_copy_block)(struct inode *dst, struct inode *src, int blk);
+        int     (* fs_copy_block)(struct inode *dst, struct inode *src, 
+                                  int blk);
         int     (* fs_set_indirect)(struct inode *pri, int index,
                                     ino_t ind_ino, ino_t parent_ino);
-        int     (* fs_snap_feature)(struct super_block *sb, int feature, int op);
-        int     (* fs_set_snap_info)(struct super_block *sb, struct inode *inode, 
-                                     void* key, __u32 keylen, void *val, 
-                                     __u32 *vallen); 
-        int     (* fs_get_snap_info)(struct super_block *sb, struct inode *inode,
-                                     void* key, __u32 keylen, void *val, 
-                                     __u32 *vallen); 
+        int     (* fs_snap_feature)(struct super_block *sb, int feature, 
+                                    int op);
+        int     (* fs_set_snap_info)(struct inode *inode, void* key, 
+                                     __u32 keylen, void *val, __u32 *vallen); 
+        int     (* fs_get_snap_info)(struct inode *inode, void* key, 
+                                     __u32 keylen, void *val, __u32 *vallen); 
+        int     (* fs_set_snap_item)(struct super_block *sb, char *name);
+        int     (* fs_read_dotsnap_dir_page)(struct file *file, char *buf, 
+                                             size_t count, loff_t *ppos);
+        int     (* fs_dir_ent_size)(char *name);
+        int     (* fs_set_dir_ent)(struct super_block *sb, char *name, 
+                                   char *buf, int buf_off, int nlen, 
+                                   size_t count);
 };
 
 extern int fsfilt_register_ops(struct fsfilt_operations *fs_ops);
@@ -212,7 +222,7 @@ fsfilt_start_ops(struct fsfilt_operations *ops, struct inode *inode,
         unsigned long now = jiffies;
         void *parent_handle = oti ? oti->oti_handle : NULL;
         void *handle = ops->fs_start(inode, op, parent_handle, logs);
-        CDEBUG(D_HA, "started handle %p (%p)\n", handle, parent_handle);
+        CDEBUG(D_INFO, "started handle %p (%p)\n", handle, parent_handle);
 
         if (oti != NULL) {
                 if (parent_handle == NULL) {
@@ -255,7 +265,7 @@ fsfilt_commit_ops(struct fsfilt_operations *ops, struct super_block *sb,
 {
         unsigned long now = jiffies;
         int rc = ops->fs_commit(sb, inode, handle, force_sync);
-        CDEBUG(D_HA, "committing handle %p\n", handle);
+        CDEBUG(D_INFO, "committing handle %p\n", handle);
 
         if (time_after(jiffies, now + 15 * HZ))
                 CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
@@ -288,7 +298,7 @@ fsfilt_brw_start_log(struct obd_device *obd, int objcount,
         void *parent_handle = oti ? oti->oti_handle : NULL;
         void *handle = obd->obd_fsops->fs_brw_start(objcount, fso, niocount, nb,
                                                     parent_handle, logs);
-        CDEBUG(D_HA, "started handle %p (%p)\n", handle, parent_handle);
+        CDEBUG(D_INFO, "started handle %p (%p)\n", handle, parent_handle);
 
         if (oti != NULL) {
                 if (parent_handle == NULL) {
@@ -320,7 +330,7 @@ fsfilt_commit_async(struct obd_device *obd, struct inode *inode,
         unsigned long now = jiffies;
         int rc = obd->obd_fsops->fs_commit_async(inode, handle, wait_handle);
 
-        CDEBUG(D_HA, "committing handle %p (async)\n", *wait_handle);
+        CDEBUG(D_INFO, "committing handle %p (async)\n", *wait_handle);
         if (time_after(jiffies, now + 15 * HZ))
                 CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
 
@@ -332,7 +342,7 @@ fsfilt_commit_wait(struct obd_device *obd, struct inode *inode, void *handle)
 {
         unsigned long now = jiffies;
         int rc = obd->obd_fsops->fs_commit_wait(inode, handle);
-        CDEBUG(D_HA, "waiting for completion %p\n", handle);
+        CDEBUG(D_INFO, "waiting for completion %p\n", handle);
         if (time_after(jiffies, now + 15 * HZ))
                 CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
         return rc;
@@ -367,29 +377,27 @@ static inline int fsfilt_setup(struct obd_device *obd,
 }
 static inline int
 fsfilt_set_md(struct obd_device *obd, struct inode *inode,
-              void *handle, void *md, int size, int flags)
+              void *handle, void *md, int size)
 {
-        return obd->obd_fsops->fs_set_md(inode, handle, md, size, flags);
+        return obd->obd_fsops->fs_set_md(inode, handle, md, size);
 }
 
 static inline int
 fsfilt_get_md(struct obd_device *obd, struct inode *inode,
-              void *md, int size, int flags)
+              void *md, int size)
 {
-        return obd->obd_fsops->fs_get_md(inode, md, size, flags);
+        return obd->obd_fsops->fs_get_md(inode, md, size);
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-static inline int
-fsfilt_send_bio(struct obd_device *obd, struct inode *inode,
-                struct bio *bio)
-#else
-static inline int
-fsfilt_send_bio(struct obd_device *obd, struct inode *inode,
-                struct kiobuf *bio)
-#endif
+static inline int fsfilt_send_bio(int rw, struct obd_device *obd,
+                                  struct inode *inode, void *bio)
 {
-        return obd->obd_fsops->fs_send_bio(inode, bio);
+        LASSERTF(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ, "%x\n", rw);
+
+        if (rw == OBD_BRW_READ)
+                return obd->obd_fsops->fs_send_bio(READ, inode, bio);
+        else
+                return obd->obd_fsops->fs_send_bio(WRITE, inode, bio);
 }
 
 static inline int
@@ -492,6 +500,13 @@ static inline int fsfilt_map_inode_pages(struct obd_device *obd,
         return obd->obd_fsops->fs_map_inode_pages(inode, page, pages, blocks,
                                                   created, create, sem);
 }
+static inline int fsfilt_get_fs_flags(struct obd_device *obd, 
+                                      struct dentry *dentry)
+{
+        if (obd->obd_fsops->fs_get_fs_flags) 
+                return obd->obd_fsops->fs_get_fs_flags(dentry);
+        return 0;
+}
 
 static inline int 
 fsfilt_write_extents(struct obd_device *obd, struct dentry *dentry, 
@@ -502,7 +517,15 @@ fsfilt_write_extents(struct obd_device *obd, struct dentry *dentry,
                                                         offset, blks);
         return 0;
 }
-
+static inline int
+fsfilt_do_write_cow(struct obd_device *obd, struct dentry *dentry,
+                    void *extents, int num_extents)
+{
+        if (obd->obd_fsops->fs_do_write_cow)
+                return obd->obd_fsops->fs_do_write_cow(dentry, extents,
+                                                       num_extents);
+        return 0;
+}
 static inline int
 fs_prep_san_write(struct obd_device *obd, struct inode *inode,
                   long *blocks, int nblocks, loff_t newsize)
@@ -543,18 +566,18 @@ llog_fsfilt_write_record(struct llog_ctxt *ctxt, struct file *file,
 }
 
 static inline int 
-fsfilt_set_kml_flags(struct obd_device *obd, struct inode *inode)
+fsfilt_set_fs_flags(struct obd_device *obd, struct inode *inode, int flags)
 {
-        if (obd->obd_fsops->fs_set_kml_flags)
-                return obd->obd_fsops->fs_set_kml_flags(inode);
+        if (obd->obd_fsops->fs_set_fs_flags)
+                return obd->obd_fsops->fs_set_fs_flags(inode, flags);
         return 0;
 }
 
 static inline int 
-fsfilt_clear_kml_flags(struct obd_device *obd, struct inode *inode)
+fsfilt_clear_fs_flags(struct obd_device *obd, struct inode *inode, int flags)
 {
-        if (obd->obd_fsops->fs_clear_kml_flags)
-                return obd->obd_fsops->fs_clear_kml_flags(inode);
+        if (obd->obd_fsops->fs_clear_fs_flags)
+                return obd->obd_fsops->fs_clear_fs_flags(inode, flags);
         return 0;
 }
 static inline int 
@@ -567,11 +590,11 @@ fsfilt_precreate_rec(struct obd_device *obd, struct dentry *dentry,
 }
 
 static inline int 
-fsfilt_post_setup(struct obd_device *obd)
+fsfilt_post_setup(struct obd_device *obd, struct dentry *de)
 {
         if (obd->obd_fsops->fs_post_setup)
                 return obd->obd_fsops->fs_post_setup(obd, 
-                                obd->obd_lvfs_ctxt.pwdmnt);
+                                obd->obd_lvfs_ctxt.pwdmnt, de);
         return 0;
 }
 
@@ -649,6 +672,14 @@ fsfilt_del_dir_entry(struct obd_device *obd, struct dentry *dentry)
         return obd->obd_fsops->fs_del_dir_entry(obd, dentry);
 }
 
+static inline int 
+fsfilt_set_snap_item(struct obd_device *obd, struct super_block *sb,
+                     char *name)
+{
+         if (obd->obd_fsops->fs_set_snap_item)
+                return obd->obd_fsops->fs_set_snap_item(sb, name);
+        return 0;
+} 
 #endif /* __KERNEL__ */
 
 #endif