1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _H_JFS_INCORE
20#define _H_JFS_INCORE
21
22#include <linux/mutex.h>
23#include <linux/rwsem.h>
24#include <linux/slab.h>
25#include <linux/bitops.h>
26#include "jfs_types.h"
27#include "jfs_xtree.h"
28#include "jfs_dtree.h"
29
30
31
32
33#define JFS_SUPER_MAGIC 0x3153464a
34
35
36
37
38struct jfs_inode_info {
39 int fileset;
40 uint mode2;
41 uint saved_uid;
42 uint saved_gid;
43 pxd_t ixpxd;
44 dxd_t acl;
45 dxd_t ea;
46 time_t otime;
47 uint next_index;
48 int acltype;
49 short btorder;
50 short btindex;
51 struct inode *ipimap;
52 unsigned long cflag;
53 u16 bxflag;
54 unchar agno;
55 signed char active_ag;
56 lid_t blid;
57 lid_t atlhead;
58 lid_t atltail;
59 spinlock_t ag_lock;
60 struct list_head anon_inode_list;
61
62
63
64
65
66 struct rw_semaphore rdwrlock;
67
68
69
70
71
72
73 struct mutex commit_mutex;
74
75 struct rw_semaphore xattr_sem;
76 lid_t xtlid;
77#ifdef CONFIG_JFS_POSIX_ACL
78 struct posix_acl *i_acl;
79 struct posix_acl *i_default_acl;
80#endif
81 union {
82 struct {
83 xtpage_t _xtroot;
84 struct inomap *_imap;
85 } file;
86 struct {
87 struct dir_table_slot _table[12];
88 dtroot_t _dtroot;
89 } dir;
90 struct {
91 unchar _unused[16];
92 dxd_t _dxd;
93 unchar _inline[128];
94
95
96
97 unchar _inline_ea[128];
98 } link;
99 } u;
100 u32 dev;
101 struct inode vfs_inode;
102};
103#define i_xtroot u.file._xtroot
104#define i_imap u.file._imap
105#define i_dirtable u.dir._table
106#define i_dtroot u.dir._dtroot
107#define i_inline u.link._inline
108#define i_inline_ea u.link._inline_ea
109
110#define JFS_ACL_NOT_CACHED ((void *)-1)
111
112#define IREAD_LOCK(ip, subclass) \
113 down_read_nested(&JFS_IP(ip)->rdwrlock, subclass)
114#define IREAD_UNLOCK(ip) up_read(&JFS_IP(ip)->rdwrlock)
115#define IWRITE_LOCK(ip, subclass) \
116 down_write_nested(&JFS_IP(ip)->rdwrlock, subclass)
117#define IWRITE_UNLOCK(ip) up_write(&JFS_IP(ip)->rdwrlock)
118
119
120
121
122enum cflags {
123 COMMIT_Nolink,
124 COMMIT_Inlineea,
125 COMMIT_Freewmap,
126 COMMIT_Dirty,
127 COMMIT_Dirtable,
128 COMMIT_Stale,
129 COMMIT_Synclist,
130};
131
132
133
134
135enum commit_mutex_class
136{
137 COMMIT_MUTEX_PARENT,
138 COMMIT_MUTEX_CHILD,
139 COMMIT_MUTEX_SECOND_PARENT,
140 COMMIT_MUTEX_VICTIM
141};
142
143
144
145
146
147
148enum rdwrlock_class
149{
150 RDWRLOCK_NORMAL,
151 RDWRLOCK_IMAP,
152 RDWRLOCK_DMAP
153};
154
155#define set_cflag(flag, ip) set_bit(flag, &(JFS_IP(ip)->cflag))
156#define clear_cflag(flag, ip) clear_bit(flag, &(JFS_IP(ip)->cflag))
157#define test_cflag(flag, ip) test_bit(flag, &(JFS_IP(ip)->cflag))
158#define test_and_clear_cflag(flag, ip) \
159 test_and_clear_bit(flag, &(JFS_IP(ip)->cflag))
160
161
162
163struct jfs_sb_info {
164 struct super_block *sb;
165 unsigned long mntflag;
166 struct inode *ipbmap;
167 struct inode *ipaimap;
168 struct inode *ipaimap2;
169 struct inode *ipimap;
170 struct jfs_log *log;
171 struct list_head log_list;
172 short bsize;
173 short l2bsize;
174 short nbperpage;
175 short l2nbperpage;
176 short l2niperblk;
177 dev_t logdev;
178 uint aggregate;
179 pxd_t logpxd;
180 pxd_t fsckpxd;
181 pxd_t ait2;
182 char uuid[16];
183 char loguuid[16];
184
185
186
187
188 int commit_state;
189
190 uint gengen;
191 uint inostamp;
192
193
194 struct bmap *bmap;
195 struct nls_table *nls_tab;
196 struct inode *direct_inode;
197 uint state;
198 unsigned long flag;
199 uint p_state;
200 uint uid;
201 uint gid;
202 uint umask;
203};
204
205
206#define IN_LAZYCOMMIT 1
207
208static inline struct jfs_inode_info *JFS_IP(struct inode *inode)
209{
210 return list_entry(inode, struct jfs_inode_info, vfs_inode);
211}
212
213static inline int jfs_dirtable_inline(struct inode *inode)
214{
215 return (JFS_IP(inode)->next_index <= (MAX_INLINE_DIRTABLE_ENTRY + 1));
216}
217
218static inline struct jfs_sb_info *JFS_SBI(struct super_block *sb)
219{
220 return sb->s_fs_info;
221}
222
223static inline int isReadOnly(struct inode *inode)
224{
225 if (JFS_SBI(inode->i_sb)->log)
226 return 0;
227 return 1;
228}
229#endif
230