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)
43 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
45 static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
47 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
54 struct ll_dentry_data {
57 struct obd_client_handle lld_cwd_och;
58 struct obd_client_handle lld_mnt_och;
61 #define ll_d2d(de) ((struct ll_dentry_data*) de->d_fsdata)
63 extern struct file_operations ll_pgcache_seq_fops;
65 #define LLI_INODE_MAGIC 0x111d0de5
66 #define LLI_INODE_DEAD 0xdeadd00d
67 #define LLI_F_HAVE_OST_SIZE_LOCK 0
68 #define LLI_F_HAVE_MDS_SIZE_LOCK 1
69 #define LLI_F_PREFER_EXTENDED_SIZE 2
71 struct ll_inode_info {
73 struct lov_stripe_md *lli_smd;
75 struct lustre_id lli_id; /* full lustre_id */
76 char *lli_symlink_name;
77 struct semaphore lli_open_sem;
80 unsigned long lli_flags;
82 /* this lock protects s_d_w and p_w_ll */
84 int lli_send_done_writing;
88 struct list_head lli_pending_write_llaps;
90 struct list_head lli_close_item;
92 struct file_operations *ll_save_ifop;
93 struct file_operations *ll_save_ffop;
94 struct file_operations *ll_save_wfop;
95 struct file_operations *ll_save_wrfop;
96 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
97 struct inode lli_vfs_inode;
101 // FIXME: replace the name of this with LL_I to conform to kernel stuff
102 // static inline struct ll_inode_info *LL_I(struct inode *inode)
103 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
105 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
106 return container_of(inode, struct ll_inode_info, lli_vfs_inode);
108 return (struct ll_inode_info *)&(inode->u.generic_ip);
114 LPROC_LL_DIRTY_HITS = 0,
115 LPROC_LL_DIRTY_MISSES,
116 LPROC_LL_WB_WRITEPAGE,
117 LPROC_LL_WB_PRESSURE,
121 LPROC_LL_WRITE_BYTES,
133 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
139 LPROC_LL_ALLOC_INODE,
141 LPROC_LL_DIRECT_READ,
142 LPROC_LL_DIRECT_WRITE,
143 LPROC_LL_FILE_OPCODES
147 ll_inode2id(struct lustre_id *id, struct inode *inode)
149 struct lustre_id *lid = &ll_i2info(inode)->lli_id;
151 mdc_pack_id(id, inode->i_ino, inode->i_generation,
152 (inode->i_mode & S_IFMT), id_group(lid),
157 ll_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
158 struct inode *i2, const char *name, int namelen,
163 ll_inode2id(&data->id1, i1);
165 /* it could be directory with mea */
166 data->mea1 = ll_i2info(i1)->lli_mea;
169 ll_inode2id(&data->id2, i2);
170 data->mea2 = ll_i2info(i2)->lli_mea;
175 data->namelen = namelen;
176 data->create_mode = mode;
177 data->mod_time = LTIME_S(CURRENT_TIME);
181 #include <linux/lustre_idl.h>
182 #endif /* __KERNEL__ */
184 #include <lustre/lustre_user.h>