1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * lustre lite cluster file system
6 * This code is issued under the GNU General Public License.
7 * See the file COPYING in this distribution
9 * Copyright (C) 2002 Cluster File Systems, Inc. <info@clusterfs.com>
19 #include <linux/version.h>
21 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
22 #include <asm/statfs.h>
26 #include <linux/dcache.h>
27 #include <linux/jbd.h>
28 #include <linux/ext3_fs.h>
29 #include <linux/proc_fs.h>
31 #include <linux/obd_class.h>
32 #include <linux/lustre_net.h>
33 #include <linux/lustre_mds.h>
34 #include <linux/lustre_ha.h>
36 #include <linux/rbtree.h>
37 #include <linux/lustre_compat25.h>
38 #include <linux/pagemap.h>
40 /* careful, this is easy to screw up */
41 #define PAGE_CACHE_MAXBYTES ((__u64)(~0UL) << PAGE_CACHE_SHIFT)
45 struct lustre_intent_data {
46 __u64 it_lock_handle[2];
52 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
54 static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
56 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
63 struct ll_dentry_data {
66 struct obd_client_handle lld_cwd_och;
67 struct obd_client_handle lld_mnt_och;
70 #define ll_d2d(de) ((struct ll_dentry_data*) de->d_fsdata)
72 extern struct file_operations ll_pgcache_seq_fops;
74 #define LLI_INODE_MAGIC 0x111d0de5
75 #define LLI_INODE_DEAD 0xdeadd00d
76 #define LLI_F_HAVE_OST_SIZE_LOCK 0
77 #define LLI_F_HAVE_MDS_SIZE_LOCK 1
78 #define LLI_F_PREFER_EXTENDED_SIZE 2
79 struct ll_inode_info {
81 struct lov_stripe_md *lli_smd;
83 char *lli_symlink_name;
84 struct semaphore lli_open_sem;
87 unsigned long lli_flags;
90 /* this lock protects s_d_w and p_w_ll */
92 int lli_send_done_writing;
93 struct list_head lli_pending_write_llaps;
95 struct list_head lli_close_item;
97 struct file_operations *ll_save_ifop;
98 struct file_operations *ll_save_ffop;
99 struct file_operations *ll_save_wfop;
100 struct file_operations *ll_save_wrfop;
101 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
102 struct inode lli_vfs_inode;
106 // FIXME: replace the name of this with LL_I to conform to kernel stuff
107 // static inline struct ll_inode_info *LL_I(struct inode *inode)
108 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
110 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
111 return container_of(inode, struct ll_inode_info, lli_vfs_inode);
113 return (struct ll_inode_info *)&(inode->u.generic_ip);
119 LPROC_LL_DIRTY_HITS = 0,
120 LPROC_LL_DIRTY_MISSES,
121 LPROC_LL_WB_WRITEPAGE,
122 LPROC_LL_WB_PRESSURE,
126 LPROC_LL_WRITE_BYTES,
138 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
144 LPROC_LL_ALLOC_INODE,
146 LPROC_LL_DIRECT_READ,
147 LPROC_LL_DIRECT_WRITE,
148 LPROC_LL_FILE_OPCODES
151 static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
153 mdc_pack_fid(fid, inode->i_ino, inode->i_generation,
154 inode->i_mode & S_IFMT);
155 LASSERT(ll_i2info(inode));
156 fid->mds = ll_i2info(inode)->lli_mds;
159 static inline void ll_i2uctxt(struct ll_uctxt *ctxt, struct inode *i1,
165 if (in_group_p(i1->i_gid))
166 ctxt->gid1 = i1->i_gid;
171 if (in_group_p(i2->i_gid))
172 ctxt->gid2 = i2->i_gid;
180 ll_prepare_mdc_op_data(struct mdc_op_data *data, struct inode *i1,
181 struct inode *i2, const char *name, int namelen,
186 ll_i2uctxt(&data->ctxt, i1, i2);
187 ll_inode2fid(&data->fid1, i1);
189 /* it could be directory with mea */
190 data->mea1 = ll_i2info(i1)->lli_mea;
193 ll_inode2fid(&data->fid2, i2);
194 data->mea2 = ll_i2info(i2)->lli_mea;
198 data->namelen = namelen;
199 data->create_mode = mode;
200 data->mod_time = LTIME_S(CURRENT_TIME);
204 #include <linux/lustre_idl.h>
205 #endif /* __KERNEL__ */
207 #include <lustre/lustre_user.h>