0001
0002
0003
0004
0005 #ifndef _H_JFS_TXNMGR
0006 #define _H_JFS_TXNMGR
0007
0008 #include "jfs_logmgr.h"
0009
0010
0011
0012
0013 #define tid_to_tblock(tid) (&TxBlock[tid])
0014
0015 #define lid_to_tlock(lid) (&TxLock[lid])
0016
0017
0018
0019
0020 struct tblock {
0021
0022
0023
0024
0025
0026
0027 u16 xflag;
0028 u16 flag;
0029 lid_t dummy;
0030 s32 lsn;
0031 struct list_head synclist;
0032
0033
0034 struct super_block *sb;
0035 lid_t next;
0036 lid_t last;
0037 wait_queue_head_t waitor;
0038
0039
0040 u32 logtid;
0041
0042
0043 struct list_head cqueue;
0044 s32 clsn;
0045 struct lbuf *bp;
0046 s32 pn;
0047 s32 eor;
0048 wait_queue_head_t gcwait;
0049
0050
0051
0052 union {
0053 struct inode *ip;
0054 pxd_t ixpxd;
0055 } u;
0056 u32 ino;
0057 };
0058
0059 extern struct tblock *TxBlock;
0060
0061
0062 #define COMMIT_SYNC 0x0001
0063 #define COMMIT_FORCE 0x0002
0064 #define COMMIT_FLUSH 0x0004
0065 #define COMMIT_MAP 0x00f0
0066 #define COMMIT_PMAP 0x0010
0067 #define COMMIT_WMAP 0x0020
0068 #define COMMIT_PWMAP 0x0040
0069 #define COMMIT_FREE 0x0f00
0070 #define COMMIT_DELETE 0x0100
0071 #define COMMIT_TRUNCATE 0x0200
0072 #define COMMIT_CREATE 0x0400
0073 #define COMMIT_LAZY 0x0800
0074 #define COMMIT_PAGE 0x1000
0075 #define COMMIT_INODE 0x2000
0076
0077
0078
0079
0080
0081
0082 struct tlock {
0083 lid_t next;
0084
0085
0086 tid_t tid;
0087
0088 u16 flag;
0089 u16 type;
0090
0091 struct metapage *mp;
0092 struct inode *ip;
0093
0094
0095 s16 lock[24];
0096 };
0097
0098 extern struct tlock *TxLock;
0099
0100
0101
0102
0103
0104 #define tlckPAGELOCK 0x8000
0105 #define tlckINODELOCK 0x4000
0106 #define tlckLINELOCK 0x2000
0107 #define tlckINLINELOCK 0x1000
0108
0109 #define tlckLOG 0x0800
0110
0111 #define tlckUPDATEMAP 0x0080
0112 #define tlckDIRECTORY 0x0040
0113
0114 #define tlckFREELOCK 0x0008
0115 #define tlckWRITEPAGE 0x0004
0116 #define tlckFREEPAGE 0x0002
0117
0118
0119
0120
0121 #define tlckTYPE 0xfe00
0122 #define tlckINODE 0x8000
0123 #define tlckXTREE 0x4000
0124 #define tlckDTREE 0x2000
0125 #define tlckMAP 0x1000
0126 #define tlckEA 0x0800
0127 #define tlckACL 0x0400
0128 #define tlckDATA 0x0200
0129 #define tlckBTROOT 0x0100
0130
0131 #define tlckOPERATION 0x00ff
0132 #define tlckGROW 0x0001
0133 #define tlckREMOVE 0x0002
0134 #define tlckTRUNCATE 0x0004
0135 #define tlckRELOCATE 0x0008
0136 #define tlckENTRY 0x0001
0137 #define tlckEXTEND 0x0002
0138 #define tlckSPLIT 0x0010
0139 #define tlckNEW 0x0020
0140 #define tlckFREE 0x0040
0141 #define tlckRELINK 0x0080
0142
0143
0144
0145
0146
0147
0148
0149 struct lv {
0150 u8 offset;
0151 u8 length;
0152 };
0153
0154 #define TLOCKSHORT 20
0155 #define TLOCKLONG 28
0156
0157 struct linelock {
0158 lid_t next;
0159
0160 s8 maxcnt;
0161 s8 index;
0162
0163 u16 flag;
0164 u8 type;
0165 u8 l2linesize;
0166
0167
0168 struct lv lv[20];
0169 };
0170
0171 #define dt_lock linelock
0172
0173 struct xtlock {
0174 lid_t next;
0175
0176 s8 maxcnt;
0177 s8 index;
0178
0179 u16 flag;
0180 u8 type;
0181 u8 l2linesize;
0182
0183
0184 struct lv header;
0185 struct lv lwm;
0186 struct lv hwm;
0187 struct lv twm;
0188
0189
0190 s32 pxdlock[8];
0191 };
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204 struct maplock {
0205 lid_t next;
0206
0207 u8 maxcnt;
0208 u8 index;
0209
0210 u16 flag;
0211 u8 type;
0212 u8 count;
0213
0214
0215 pxd_t pxd;
0216 };
0217
0218
0219 #define mlckALLOC 0x00f0
0220 #define mlckALLOCXADLIST 0x0080
0221 #define mlckALLOCPXDLIST 0x0040
0222 #define mlckALLOCXAD 0x0020
0223 #define mlckALLOCPXD 0x0010
0224 #define mlckFREE 0x000f
0225 #define mlckFREEXADLIST 0x0008
0226 #define mlckFREEPXDLIST 0x0004
0227 #define mlckFREEXAD 0x0002
0228 #define mlckFREEPXD 0x0001
0229
0230 #define pxd_lock maplock
0231
0232 struct xdlistlock {
0233 lid_t next;
0234
0235 u8 maxcnt;
0236 u8 index;
0237
0238 u16 flag;
0239 u8 type;
0240 u8 count;
0241
0242
0243
0244
0245
0246
0247 union {
0248 void *_xdlist;
0249 s64 pad;
0250 } union64;
0251 };
0252
0253 #define xdlist union64._xdlist
0254
0255
0256
0257
0258
0259
0260 struct commit {
0261 tid_t tid;
0262 int flag;
0263 struct jfs_log *log;
0264 struct super_block *sb;
0265
0266 int nip;
0267 struct inode **iplist;
0268
0269
0270 struct lrd lrd;
0271 };
0272
0273
0274
0275
0276 extern int jfs_tlocks_low;
0277
0278 extern int txInit(void);
0279 extern void txExit(void);
0280 extern struct tlock *txLock(tid_t, struct inode *, struct metapage *, int);
0281 extern struct tlock *txMaplock(tid_t, struct inode *, int);
0282 extern int txCommit(tid_t, int, struct inode **, int);
0283 extern tid_t txBegin(struct super_block *, int);
0284 extern void txBeginAnon(struct super_block *);
0285 extern void txEnd(tid_t);
0286 extern void txAbort(tid_t, int);
0287 extern struct linelock *txLinelock(struct linelock *);
0288 extern void txFreeMap(struct inode *, struct maplock *, struct tblock *, int);
0289 extern void txEA(tid_t, struct inode *, dxd_t *, dxd_t *);
0290 extern void txFreelock(struct inode *);
0291 extern int lmLog(struct jfs_log *, struct tblock *, struct lrd *,
0292 struct tlock *);
0293 extern void txQuiesce(struct super_block *);
0294 extern void txResume(struct super_block *);
0295 extern void txLazyUnlock(struct tblock *);
0296 extern int jfs_lazycommit(void *);
0297 extern int jfs_sync(void *);
0298 #endif