#include <linux/fs.h>
#include <linux/ext2_fs.h>
+#include <linux/proc_fs.h>
#include <linux/obd_class.h>
#include <linux/lustre_net.h>
__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;
};
char *lli_symlink_name;
struct lustre_handle lli_intent_lock_handle;
struct semaphore lli_open_sem;
- __u32 lli_mount_epoch;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+ struct inode lli_vfs_inode;
+#endif
};
+
+
#define LL_SUPER_MAGIC 0x0BD00BD0
#define LL_COMMITCBD_STOPPING 0x1
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;
time_t ll_commitcbd_timeout;
spinlock_t ll_commitcbd_lock;
struct list_head ll_conn_chain; /* per-conn chain of SBs */
- __u32 ll_mount_epoch;
};
-#define CHECK_MOUNT_EPOCH(i) \
-do { \
- if (ll_i2info(i)->lli_mount_epoch != ll_i2sbi(i)->ll_mount_epoch) { \
- make_bad_inode(i); \
- RETURN(-EIO); \
- } \
-} while(0)
-
static inline struct ll_sb_info *ll_s2sbi(struct super_block *sb)
{
+#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);
+#endif
}
static inline struct lustre_handle *ll_s2obdconn(struct super_block *sb)
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)
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 *de);
+void ll_intent_release(struct dentry *, struct lookup_intent *);
int ll_set_dd(struct dentry *de);
+/****
+
+I originally implmented these as functions, then realized a macro
+would be more helpful for debugging, so the CDEBUG messages show
+the current calling function. The orignal functions are in llite/dcache.c
+
+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); \
+ \
+ down(&ll_d2d(de)->lld_it_sem); \
+ de->d_it = it; \
+ CDEBUG(D_DENTRY, "D_IT DOWN dentry %p fsdata %p intent: %s sem %d\n", \
+ de, ll_d2d(de), ldlm_it2str(de->d_it->it_op), \
+ atomic_read(&(ll_d2d(de)->lld_it_sem.count))); \
+} while(0)
+
+#define LL_GET_INTENT(de, it) \
+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)
+
/* dir.c */
extern struct file_operations ll_dir_operations;
extern struct inode_operations ll_dir_inode_operations;