0001
0002
0003
0004
0005
0006 #ifndef _H_JFS_INCORE
0007 #define _H_JFS_INCORE
0008
0009 #include <linux/mutex.h>
0010 #include <linux/rwsem.h>
0011 #include <linux/slab.h>
0012 #include <linux/bitops.h>
0013 #include <linux/uuid.h>
0014
0015 #include "jfs_types.h"
0016 #include "jfs_xtree.h"
0017 #include "jfs_dtree.h"
0018
0019
0020
0021
0022 #define JFS_SUPER_MAGIC 0x3153464a
0023
0024
0025
0026
0027 struct jfs_inode_info {
0028 int fileset;
0029 uint mode2;
0030 kuid_t saved_uid;
0031 kgid_t saved_gid;
0032 pxd_t ixpxd;
0033 dxd_t acl;
0034 dxd_t ea;
0035 time64_t otime;
0036 uint next_index;
0037 int acltype;
0038 short btorder;
0039 short btindex;
0040 struct inode *ipimap;
0041 unsigned long cflag;
0042 u64 agstart;
0043 u16 bxflag;
0044 unchar pad;
0045 signed char active_ag;
0046 lid_t blid;
0047 lid_t atlhead;
0048 lid_t atltail;
0049 spinlock_t ag_lock;
0050 struct list_head anon_inode_list;
0051
0052
0053
0054
0055
0056 struct rw_semaphore rdwrlock;
0057
0058
0059
0060
0061
0062
0063 struct mutex commit_mutex;
0064
0065 struct rw_semaphore xattr_sem;
0066 lid_t xtlid;
0067 union {
0068 struct {
0069 xtpage_t _xtroot;
0070 struct inomap *_imap;
0071 } file;
0072 struct {
0073 struct dir_table_slot _table[12];
0074 dtroot_t _dtroot;
0075 } dir;
0076 struct {
0077 unchar _unused[16];
0078 dxd_t _dxd;
0079
0080
0081
0082
0083 union {
0084 struct {
0085
0086 unchar _inline[128];
0087
0088 unchar _inline_ea[128];
0089 };
0090 unchar _inline_all[256];
0091 };
0092 } link;
0093 } u;
0094 #ifdef CONFIG_QUOTA
0095 struct dquot *i_dquot[MAXQUOTAS];
0096 #endif
0097 u32 dev;
0098 struct inode vfs_inode;
0099 };
0100 #define i_xtroot u.file._xtroot
0101 #define i_imap u.file._imap
0102 #define i_dirtable u.dir._table
0103 #define i_dtroot u.dir._dtroot
0104 #define i_inline u.link._inline
0105 #define i_inline_ea u.link._inline_ea
0106 #define i_inline_all u.link._inline_all
0107
0108 #define IREAD_LOCK(ip, subclass) \
0109 down_read_nested(&JFS_IP(ip)->rdwrlock, subclass)
0110 #define IREAD_UNLOCK(ip) up_read(&JFS_IP(ip)->rdwrlock)
0111 #define IWRITE_LOCK(ip, subclass) \
0112 down_write_nested(&JFS_IP(ip)->rdwrlock, subclass)
0113 #define IWRITE_UNLOCK(ip) up_write(&JFS_IP(ip)->rdwrlock)
0114
0115
0116
0117
0118 enum cflags {
0119 COMMIT_Nolink,
0120 COMMIT_Inlineea,
0121 COMMIT_Freewmap,
0122 COMMIT_Dirty,
0123 COMMIT_Dirtable,
0124 COMMIT_Stale,
0125 COMMIT_Synclist,
0126 };
0127
0128
0129
0130
0131 enum commit_mutex_class
0132 {
0133 COMMIT_MUTEX_PARENT,
0134 COMMIT_MUTEX_CHILD,
0135 COMMIT_MUTEX_SECOND_PARENT,
0136 COMMIT_MUTEX_VICTIM
0137 };
0138
0139
0140
0141
0142
0143
0144 enum rdwrlock_class
0145 {
0146 RDWRLOCK_NORMAL,
0147 RDWRLOCK_IMAP,
0148 RDWRLOCK_DMAP
0149 };
0150
0151 #define set_cflag(flag, ip) set_bit(flag, &(JFS_IP(ip)->cflag))
0152 #define clear_cflag(flag, ip) clear_bit(flag, &(JFS_IP(ip)->cflag))
0153 #define test_cflag(flag, ip) test_bit(flag, &(JFS_IP(ip)->cflag))
0154 #define test_and_clear_cflag(flag, ip) \
0155 test_and_clear_bit(flag, &(JFS_IP(ip)->cflag))
0156
0157
0158
0159 struct jfs_sb_info {
0160 struct super_block *sb;
0161 unsigned long mntflag;
0162 struct inode *ipbmap;
0163 struct inode *ipaimap;
0164 struct inode *ipaimap2;
0165 struct inode *ipimap;
0166 struct jfs_log *log;
0167 struct list_head log_list;
0168 short bsize;
0169 short l2bsize;
0170 short nbperpage;
0171 short l2nbperpage;
0172 short l2niperblk;
0173 dev_t logdev;
0174 uint aggregate;
0175 pxd_t logpxd;
0176 pxd_t fsckpxd;
0177 pxd_t ait2;
0178 uuid_t uuid;
0179 uuid_t loguuid;
0180
0181
0182
0183
0184 int commit_state;
0185
0186 uint gengen;
0187 uint inostamp;
0188
0189
0190 struct bmap *bmap;
0191 struct nls_table *nls_tab;
0192 struct inode *direct_inode;
0193 uint state;
0194 unsigned long flag;
0195 uint p_state;
0196 kuid_t uid;
0197 kgid_t gid;
0198 uint umask;
0199 uint minblks_trim;
0200 };
0201
0202
0203 #define IN_LAZYCOMMIT 1
0204
0205 static inline struct jfs_inode_info *JFS_IP(struct inode *inode)
0206 {
0207 return container_of(inode, struct jfs_inode_info, vfs_inode);
0208 }
0209
0210 static inline int jfs_dirtable_inline(struct inode *inode)
0211 {
0212 return (JFS_IP(inode)->next_index <= (MAX_INLINE_DIRTABLE_ENTRY + 1));
0213 }
0214
0215 static inline struct jfs_sb_info *JFS_SBI(struct super_block *sb)
0216 {
0217 return sb->s_fs_info;
0218 }
0219
0220 static inline int isReadOnly(struct inode *inode)
0221 {
0222 if (JFS_SBI(inode->i_sb)->log)
0223 return 0;
0224 return 1;
0225 }
0226 #endif