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