Whamcloud - gitweb
Lproc-snmp code drop
[fs/lustre-release.git] / lustre / include / linux / lustre_lite.h
index 825b53d..d0be35f 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <linux/fs.h>
 #include <linux/ext2_fs.h>
+#include <linux/proc_fs.h>
 
 #include <linux/obd_class.h>
 #include <linux/lustre_net.h>
@@ -32,6 +33,13 @@ struct ll_file_data {
         __u32 fd_flags;
 };
 
+struct lustre_intent_data { 
+       __u64 it_lock_handle[2];
+       __u32 it_disposition;
+       __u32 it_status;
+       __u32 it_lock_mode;
+};
+
 struct ll_dentry_data {
         struct semaphore      lld_it_sem;
 };
@@ -54,12 +62,6 @@ struct ll_inode_info {
 #endif
 };
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-static inline struct ll_inode_info *LL_I(struct inode *inode)
-{
-        return container_of(inode, struct ll_inode_info, lli_vfs_inode);
-}
-#endif
 
 
 #define LL_SUPER_MAGIC 0x0BD00BD0
@@ -74,6 +76,7 @@ struct ll_sb_info {
         obd_uuid_t                ll_sb_uuid;
         struct lustre_handle      ll_mdc_conn;
         struct lustre_handle      ll_osc_conn;
+        struct proc_dir_entry*    ll_mnt_root;
         obd_id                    ll_rootino; /* number of root inode */
 
         int                       ll_flags;
@@ -89,7 +92,7 @@ struct ll_sb_info {
 
 static inline struct ll_sb_info *ll_s2sbi(struct super_block *sb)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+#if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         return (struct ll_sb_info *)(sb->s_fs_info);
 #else
         return (struct ll_sb_info *)(sb->u.generic_sbp);
@@ -109,14 +112,22 @@ static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi)
         return &obd->u.cli;
 }
 
+// FIXME: replace the name of this with LL_SB to conform to kernel stuff
 static inline struct ll_sb_info *ll_i2sbi(struct inode *inode)
 {
         return ll_s2sbi(inode->i_sb);
 }
 
+
+// FIXME: replace the name of this with LL_I to conform to kernel stuff
+// static inline struct ll_inode_info *LL_I(struct inode *inode)
 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
 {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+               return container_of(inode, struct ll_inode_info, lli_vfs_inode);
+#else
         return (struct ll_inode_info *)&(inode->u.generic_ip);
+#endif
 }
 
 static inline struct lustre_handle *ll_i2obdconn(struct inode *inode)
@@ -153,6 +164,12 @@ int ll_lock(struct inode *dir, struct dentry *dentry,
             struct lookup_intent *it, struct lustre_handle *lockh);
 int ll_unlock(__u32 mode, struct lustre_handle *lockh);
 
+typedef int (*intent_finish_cb)(int flag, struct ptlrpc_request *,
+                                struct dentry **, struct lookup_intent *,
+                                int offset, obd_id ino);
+int ll_intent_lock(struct inode *parent, struct dentry **,
+                   struct lookup_intent *, intent_finish_cb);
+
 /* dcache.c */
 void ll_intent_release(struct dentry *, struct lookup_intent *);
 int ll_set_dd(struct dentry *de);
@@ -167,6 +184,8 @@ int ll_save_intent(struct dentry * de, struct lookup_intent * it);
 struct lookup_intent * ll_get_intent(struct dentry * de);
 ****/
 
+#define IT_RELEASED_MAGIC 0xDEADCAFE
+
 #define LL_SAVE_INTENT(de, it)                                                 \
 do {                                                                           \
         LASSERT(ll_d2d(de) != NULL);                                           \
@@ -183,10 +202,12 @@ do {                                                                           \
         it = de->d_it;                                                         \
                                                                                \
         LASSERT(ll_d2d(de) != NULL);                                           \
+        LASSERT(it->it_op != IT_RELEASED_MAGIC);                               \
                                                                                \
         CDEBUG(D_DENTRY, "D_IT UP dentry %p fsdata %p intent: %s\n",           \
                de, ll_d2d(de), ldlm_it2str(de->d_it->it_op));                  \
         de->d_it = NULL;                                                       \
+        it->it_op = IT_RELEASED_MAGIC;                                         \
         up(&ll_d2d(de)->lld_it_sem);                                           \
 } while(0)