1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _H_JFS_TXNMGR
19#define _H_JFS_TXNMGR
20
21#include "jfs_logmgr.h"
22
23
24
25
26#define tid_to_tblock(tid) (&TxBlock[tid])
27
28#define lid_to_tlock(lid) (&TxLock[lid])
29
30
31
32
33struct tblock {
34
35
36
37
38
39
40 u16 xflag;
41 u16 flag;
42 lid_t dummy;
43 s32 lsn;
44 struct list_head synclist;
45
46
47 struct super_block *sb;
48 lid_t next;
49 lid_t last;
50 wait_queue_head_t waitor;
51
52
53 u32 logtid;
54
55
56 struct list_head cqueue;
57 s32 clsn;
58 struct lbuf *bp;
59 s32 pn;
60 s32 eor;
61 wait_queue_head_t gcwait;
62
63
64
65 union {
66 struct inode *ip;
67 pxd_t ixpxd;
68 } u;
69 u32 ino;
70};
71
72extern struct tblock *TxBlock;
73
74
75#define COMMIT_SYNC 0x0001
76#define COMMIT_FORCE 0x0002
77#define COMMIT_FLUSH 0x0004
78#define COMMIT_MAP 0x00f0
79#define COMMIT_PMAP 0x0010
80#define COMMIT_WMAP 0x0020
81#define COMMIT_PWMAP 0x0040
82#define COMMIT_FREE 0x0f00
83#define COMMIT_DELETE 0x0100
84#define COMMIT_TRUNCATE 0x0200
85#define COMMIT_CREATE 0x0400
86#define COMMIT_LAZY 0x0800
87#define COMMIT_PAGE 0x1000
88#define COMMIT_INODE 0x2000
89
90
91
92
93
94
95struct tlock {
96 lid_t next;
97
98
99 tid_t tid;
100
101 u16 flag;
102 u16 type;
103
104 struct metapage *mp;
105 struct inode *ip;
106
107
108 s16 lock[24];
109};
110
111extern struct tlock *TxLock;
112
113
114
115
116
117#define tlckPAGELOCK 0x8000
118#define tlckINODELOCK 0x4000
119#define tlckLINELOCK 0x2000
120#define tlckINLINELOCK 0x1000
121
122#define tlckLOG 0x0800
123
124#define tlckUPDATEMAP 0x0080
125#define tlckDIRECTORY 0x0040
126
127#define tlckFREELOCK 0x0008
128#define tlckWRITEPAGE 0x0004
129#define tlckFREEPAGE 0x0002
130
131
132
133
134#define tlckTYPE 0xfe00
135#define tlckINODE 0x8000
136#define tlckXTREE 0x4000
137#define tlckDTREE 0x2000
138#define tlckMAP 0x1000
139#define tlckEA 0x0800
140#define tlckACL 0x0400
141#define tlckDATA 0x0200
142#define tlckBTROOT 0x0100
143
144#define tlckOPERATION 0x00ff
145#define tlckGROW 0x0001
146#define tlckREMOVE 0x0002
147#define tlckTRUNCATE 0x0004
148#define tlckRELOCATE 0x0008
149#define tlckENTRY 0x0001
150#define tlckEXTEND 0x0002
151#define tlckSPLIT 0x0010
152#define tlckNEW 0x0020
153#define tlckFREE 0x0040
154#define tlckRELINK 0x0080
155
156
157
158
159
160
161
162struct lv {
163 u8 offset;
164 u8 length;
165};
166
167#define TLOCKSHORT 20
168#define TLOCKLONG 28
169
170struct linelock {
171 lid_t next;
172
173 s8 maxcnt;
174 s8 index;
175
176 u16 flag;
177 u8 type;
178 u8 l2linesize;
179
180
181 struct lv lv[20];
182};
183
184#define dt_lock linelock
185
186struct xtlock {
187 lid_t next;
188
189 s8 maxcnt;
190 s8 index;
191
192 u16 flag;
193 u8 type;
194 u8 l2linesize;
195
196
197 struct lv header;
198 struct lv lwm;
199 struct lv hwm;
200 struct lv twm;
201
202
203 s32 pxdlock[8];
204};
205
206
207
208
209
210
211
212
213
214
215
216
217struct maplock {
218 lid_t next;
219
220 u8 maxcnt;
221 u8 index;
222
223 u16 flag;
224 u8 type;
225 u8 count;
226
227
228 pxd_t pxd;
229};
230
231
232#define mlckALLOC 0x00f0
233#define mlckALLOCXADLIST 0x0080
234#define mlckALLOCPXDLIST 0x0040
235#define mlckALLOCXAD 0x0020
236#define mlckALLOCPXD 0x0010
237#define mlckFREE 0x000f
238#define mlckFREEXADLIST 0x0008
239#define mlckFREEPXDLIST 0x0004
240#define mlckFREEXAD 0x0002
241#define mlckFREEPXD 0x0001
242
243#define pxd_lock maplock
244
245struct xdlistlock {
246 lid_t next;
247
248 u8 maxcnt;
249 u8 index;
250
251 u16 flag;
252 u8 type;
253 u8 count;
254
255
256
257
258
259
260 union {
261 void *_xdlist;
262 s64 pad;
263 } union64;
264};
265
266#define xdlist union64._xdlist
267
268
269
270
271
272
273struct commit {
274 tid_t tid;
275 int flag;
276 struct jfs_log *log;
277 struct super_block *sb;
278
279 int nip;
280 struct inode **iplist;
281
282
283 struct lrd lrd;
284};
285
286
287
288
289extern int jfs_tlocks_low;
290
291extern int txInit(void);
292extern void txExit(void);
293extern struct tlock *txLock(tid_t, struct inode *, struct metapage *, int);
294extern struct tlock *txMaplock(tid_t, struct inode *, int);
295extern int txCommit(tid_t, int, struct inode **, int);
296extern tid_t txBegin(struct super_block *, int);
297extern void txBeginAnon(struct super_block *);
298extern void txEnd(tid_t);
299extern void txAbort(tid_t, int);
300extern struct linelock *txLinelock(struct linelock *);
301extern void txFreeMap(struct inode *, struct maplock *, struct tblock *, int);
302extern void txEA(tid_t, struct inode *, dxd_t *, dxd_t *);
303extern void txFreelock(struct inode *);
304extern int lmLog(struct jfs_log *, struct tblock *, struct lrd *,
305 struct tlock *);
306extern void txQuiesce(struct super_block *);
307extern void txResume(struct super_block *);
308extern void txLazyUnlock(struct tblock *);
309extern int jfs_lazycommit(void *);
310extern int jfs_sync(void *);
311#endif
312