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>
39 #include <linux/namei.h>
42 /* careful, this is easy to screw up */
43 #define PAGE_CACHE_MAXBYTES ((__u64)(~0UL) << PAGE_CACHE_SHIFT)
45 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
47 static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
49 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
50 return &nd->intent.open;
56 struct ll_dentry_data {
59 struct obd_client_handle lld_cwd_och;
60 struct obd_client_handle lld_mnt_och;
63 #define ll_d2d(de) ((struct ll_dentry_data*) de->d_fsdata)
65 extern struct file_operations ll_pgcache_seq_fops;
67 #define LLI_INODE_MAGIC 0x111d0de5
68 #define LLI_INODE_DEAD 0xdeadd00d
69 #define LLI_F_HAVE_OST_SIZE_LOCK 0
70 #define LLI_F_HAVE_MDS_SIZE_LOCK 1
71 #define LLI_F_PREFER_EXTENDED_SIZE 2
73 struct ll_inode_info {
76 struct lov_stripe_md *lli_smd;
78 struct lustre_id lli_id; /* full lustre_id */
79 char *lli_symlink_name;
80 struct semaphore lli_open_sem;
81 struct semaphore lli_size_sem;
84 unsigned long lli_flags;
86 /* this lock protects s_d_w and p_w_ll */
88 int lli_send_done_writing;
92 struct list_head lli_pending_write_llaps;
94 struct list_head lli_close_item;
96 struct file_operations *ll_save_ifop;
97 struct file_operations *ll_save_ffop;
98 struct file_operations *ll_save_wfop;
99 struct file_operations *ll_save_wrfop;
100 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
101 struct inode lli_vfs_inode;
103 struct semaphore lli_och_sem; /* Protects access to och pointers
104 and their usage counters */
105 /* We need all three because every inode may be opened in different
107 struct obd_client_handle *lli_mds_read_och;
108 __u64 lli_open_fd_read_count;
109 struct obd_client_handle *lli_mds_write_och;
110 __u64 lli_open_fd_write_count;
111 struct obd_client_handle *lli_mds_exec_och;
112 __u64 lli_open_fd_exec_count;
113 struct posix_acl *lli_acl_access;
116 // FIXME: replace the name of this with LL_I to conform to kernel stuff
117 // static inline struct ll_inode_info *LL_I(struct inode *inode)
118 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
120 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
121 return container_of(inode, struct ll_inode_info, lli_vfs_inode);
123 return (struct ll_inode_info *)&(inode->u.generic_ip);
129 LPROC_LL_DIRTY_HITS = 0,
130 LPROC_LL_DIRTY_MISSES,
131 LPROC_LL_WB_WRITEPAGE,
132 LPROC_LL_WB_PRESSURE,
136 LPROC_LL_WRITE_BYTES,
148 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
154 LPROC_LL_ALLOC_INODE,
156 LPROC_LL_DIRECT_READ,
157 LPROC_LL_DIRECT_WRITE,
160 LPROC_LL_FILE_OPCODES,
163 struct lustre_intent_data {
166 __u64 it_lock_handle;
170 #define LUSTRE_IT(it) ((struct lustre_intent_data *)((it)->d.fs_data))
173 #include <linux/lustre_idl.h>
174 #endif /* __KERNEL__ */
176 #define LLAP_FROM_COOKIE(c) \
177 (LASSERT(((struct ll_async_page *)(c))->llap_magic == LLAP_MAGIC), \
178 (struct ll_async_page *)(c))
180 #include <lustre/lustre_user.h>