#ifdef __KERNEL__
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+#include <asm/statfs.h>
+#endif
+
#include <linux/fs.h>
+#include <linux/dcache.h>
#include <linux/ext2_fs.h>
#include <linux/proc_fs.h>
__u32 it_lock_mode;
};
+#define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
+
+static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+ return &nd->it;
+#else
+ return nd->it;
+#endif
+}
+
struct ll_dentry_data {
- struct semaphore lld_it_sem;
+ int lld_cwd_count;
+ int lld_mnt_count;
+ struct obd_client_handle lld_cwd_och;
+ struct obd_client_handle lld_mnt_och;
};
-#define ll_d2d(dentry) ((struct ll_dentry_data*) dentry->d_fsdata)
+#define ll_d2d(de) ((struct ll_dentry_data*) de->d_fsdata)
extern struct file_operations ll_pgcache_seq_fops;
+/*
+ * XXX used in obdecho/echo_client.c must move (pjb)
+ *'p' list as its a list of pages linked together
+ * by ->private..
+ */
+struct plist {
+ struct page *pl_head;
+ struct page *pl_tail;
+ int pl_num;
+};
+
+struct ll_dirty_offsets {
+ rb_root_t do_root;
+ spinlock_t do_lock;
+ unsigned long do_num_dirty;
+};
+
+struct ll_writeback_pages {
+ obd_count npgs, max;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+ int rw;
+ struct inode *inode;
+ struct brw_page pga[0];
+#else
+ struct brw_page *pga;
+#endif
+};
+
struct ll_inode_info {
struct lov_stripe_md *lli_smd;
char *lli_symlink_name;
struct semaphore lli_open_sem;
struct list_head lli_read_extents;
- loff_t lli_maxbytes;
+ __u64 lli_maxbytes;
spinlock_t lli_read_extent_lock;
unsigned long lli_flags;
#define LLI_F_HAVE_SIZE_LOCK 0
struct ldlm_extent re_extent;
};
-int ll_check_dirty( struct super_block *sb );
-int ll_batch_writepage( struct inode *inode, struct page *page );
-
-/* interpet return codes from intent lookup */
-#define LL_LOOKUP_POSITIVE 1
-#define LL_LOOKUP_NEGATIVE 2
-
#define LL_SUPER_MAGIC 0x0BD00BD0
#define LL_COMMITCBD_STOPPING 0x1
struct lprocfs_stats *ll_stats; /* lprocfs stats counter */
};
-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
+#define ll_s2sbi(sb) ((struct ll_sb_info *)((sb)->s_fs_info))
+void __d_rehash(struct dentry * entry, int lock);
+static inline __u64 ll_ts2u64(struct timespec *time)
+{
+ __u64 t = time->tv_sec;
+ return t;
+}
+#else /* 2.4 here */
+#define ll_s2sbi(sb) ((struct ll_sb_info *)((sb)->u.generic_sbp))
+static inline __u64 ll_ts2u64(time_t *time)
+{
+ return *time;
}
+#endif
static inline struct lustre_handle *ll_s2obdconn(struct super_block *sb)
{
return ll_s2sbi(inode->i_sb);
}
-static inline void d_unhash_aliases(struct inode *inode)
-{
- struct dentry *dentry = NULL;
- struct list_head *tmp;
- struct ll_sb_info *sbi = ll_i2sbi(inode);
- ENTRY;
-
- CDEBUG(D_INODE, "marking dentries for ino %lx/%x invalid\n",
- inode->i_ino, inode->i_generation);
-
- spin_lock(&dcache_lock);
- list_for_each(tmp, &inode->i_dentry) {
- dentry = list_entry(tmp, struct dentry, d_alias);
-
- list_del_init(&dentry->d_hash);
- dentry->d_flags |= DCACHE_LUSTRE_INVALID;
- list_add(&dentry->d_hash, &sbi->ll_orphan_dentry_list);
- }
-
- spin_unlock(&dcache_lock);
- EXIT;
-}
-
// 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)
return sbi2mdc(ll_s2sbi(sb))->cl_max_mds_easize;
}
-static inline loff_t ll_file_maxbytes(struct inode *inode)
+static inline __u64 ll_file_maxbytes(struct inode *inode)
{
return ll_i2info(inode)->lli_maxbytes;
}
/* namei.c */
-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 *,
+typedef int (*intent_finish_cb)(struct ptlrpc_request *,
struct inode *parent, 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);
+ struct lookup_intent *, int, intent_finish_cb);
int ll_mdc_blocking_ast(struct ldlm_lock *lock,
struct ldlm_lock_desc *desc,
void *data, int flag);
struct inode *i1, struct inode *i2,
const char *name, int namelen, int mode);
-/* dcache.c */
-void ll_intent_release(struct dentry *, struct lookup_intent *);
-
-/****
-
-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); \
- LASSERT(de->d_it == NULL); \
- de->d_it = it; \
- CDEBUG(D_DENTRY, \
- "D_IT DOWN dentry %p fsdata %p intent: %p %s sem %d\n", \
- de, ll_d2d(de), de->d_it, 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); \
- LASSERT(it->it_op != IT_RELEASED_MAGIC); \
- \
- CDEBUG(D_DENTRY, "D_IT UP dentry %p fsdata %p intent: %p %s\n", \
- de, ll_d2d(de), de->d_it, 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)
-
-#define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
-
+/* lprocfs.c */
enum {
LPROC_LL_DIRTY_HITS = 0,
LPROC_LL_DIRTY_MISSES,
extern struct inode_operations ll_file_inode_operations;
extern struct inode_operations ll_special_inode_operations;
struct ldlm_lock;
-int ll_extent_lock_callback(struct ldlm_lock *, struct ldlm_lock_desc *,
- void *data, int flag);
int ll_extent_lock_no_validate(struct ll_file_data *fd, struct inode *inode,
struct lov_stripe_md *lsm, int mode,
struct ldlm_extent *extent, struct lustre_handle *lockh);
int ll_file_release(struct inode *inode, struct file *file);
-/* rw.c */
-struct page *ll_getpage(struct inode *inode, unsigned long offset,
- int create, int locked);
-void ll_truncate(struct inode *inode);
/* super.c */
void ll_update_inode(struct inode *, struct mds_body *, struct lov_stripe_md *);
int ll_setattr_raw(struct inode *inode, struct iattr *attr);
+int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
+ unsigned long maxage);
/* symlink.c */
extern struct inode_operations ll_fast_symlink_inode_operations;
extern struct inode_operations ll_symlink_inode_operations;
-/* sysctl.c */
-void ll_sysctl_init(void);
-void ll_sysctl_clean(void);
-
#else
#include <linux/lustre_idl.h>
#endif /* __KERNEL__ */
-static inline void ll_ino2fid(struct ll_fid *fid,
- obd_id ino,
- __u32 generation,
+static inline void ll_ino2fid(struct ll_fid *fid, obd_id ino, __u32 generation,
int type)
{
fid->id = ino;
fid->f_type = type;
}
-struct ll_read_inode2_cookie {
- struct mds_body *lic_body;
- struct lov_stripe_md *lic_lsm;
-};
-
#include <asm/types.h>
#define LL_IOC_GETFLAGS _IOR ('f', 151, long)