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