1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 2 /* 3 * Copyright (C) International Business Mach 4 */ 5 #ifndef _H_JFS_TXNMGR 6 #define _H_JFS_TXNMGR 7 8 #include "jfs_logmgr.h" 9 10 /* 11 * Hide implementation of TxBlock and TxLock 12 */ 13 #define tid_to_tblock(tid) (&TxBlock[tid]) 14 15 #define lid_to_tlock(lid) (&TxLock[lid]) 16 17 /* 18 * transaction block 19 */ 20 struct tblock { 21 /* 22 * tblock and jbuf_t common area: stru 23 * 24 * the following 5 fields are the same 25 * which is common to tblock and jbuf 26 */ 27 u16 xflag; /* tx commit t 28 u16 flag; /* tx commit s 29 lid_t dummy; /* Must keep s 30 s32 lsn; /* recovery ls 31 struct list_head synclist; /* log 32 33 /* lock management */ 34 struct super_block *sb; /* super block 35 lid_t next; /* index of fi 36 lid_t last; /* index of la 37 wait_queue_head_t waitor; /* tid 38 39 /* log management */ 40 u32 logtid; /* log transac 41 42 /* commit management */ 43 struct list_head cqueue; /* com 44 s32 clsn; /* commit lsn 45 struct lbuf *bp; 46 s32 pn; /* commit reco 47 s32 eor; /* commit reco 48 wait_queue_head_t gcwait; /* gro 49 * rea 50 * eve 51 */ 52 union { 53 struct inode *ip; /* inode bei 54 pxd_t ixpxd; /* pxd of inod 55 } u; 56 u32 ino; /* inode numbe 57 }; 58 59 extern struct tblock *TxBlock; /* transaction 60 61 /* commit flags: tblk->xflag */ 62 #define COMMIT_SYNC 0x0001 /* synchronous 63 #define COMMIT_FORCE 0x0002 /* force pageo 64 #define COMMIT_FLUSH 0x0004 /* init flush 65 #define COMMIT_MAP 0x00f0 66 #define COMMIT_PMAP 0x0010 /* update pmap 67 #define COMMIT_WMAP 0x0020 /* update wmap 68 #define COMMIT_PWMAP 0x0040 /* update pwma 69 #define COMMIT_FREE 0x0f00 70 #define COMMIT_DELETE 0x0100 /* inode delet 71 #define COMMIT_TRUNCATE 0x0200 /* file trunca 72 #define COMMIT_CREATE 0x0400 /* inode creat 73 #define COMMIT_LAZY 0x0800 /* lazy commit 74 #define COMMIT_PAGE 0x1000 /* Identifies 75 #define COMMIT_INODE 0x2000 /* Identifies 76 77 /* group commit flags tblk->flag: see jfs_logm 78 79 /* 80 * transaction lock 81 */ 82 struct tlock { 83 lid_t next; /* 2: index ne 84 * ne 85 */ 86 tid_t tid; /* 2: transact 87 88 u16 flag; /* 2: lock con 89 u16 type; /* 2: log type 90 91 struct metapage *mp; /* 4/8: object 92 struct inode *ip; /* 4/8: object 93 /* (16) */ 94 95 s16 lock[24]; /* 48: overlay 96 }; /* (64) */ 97 98 extern struct tlock *TxLock; /* transaction 99 100 /* 101 * tlock flag 102 */ 103 /* txLock state */ 104 #define tlckPAGELOCK 0x8000 105 #define tlckINODELOCK 0x4000 106 #define tlckLINELOCK 0x2000 107 #define tlckINLINELOCK 0x1000 108 /* lmLog state */ 109 #define tlckLOG 0x0800 110 /* updateMap state */ 111 #define tlckUPDATEMAP 0x0080 112 #define tlckDIRECTORY 0x0040 113 /* freeLock state */ 114 #define tlckFREELOCK 0x0008 115 #define tlckWRITEPAGE 0x0004 116 #define tlckFREEPAGE 0x0002 117 118 /* 119 * tlock type 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 /* fil 133 #define tlckREMOVE 0x0002 /* fil 134 #define tlckTRUNCATE 0x0004 /* fil 135 #define tlckRELOCATE 0x0008 /* fil 136 #define tlckENTRY 0x0001 /* dir 137 #define tlckEXTEND 0x0002 /* dir 138 #define tlckSPLIT 0x0010 /* spl 139 #define tlckNEW 0x0020 /* new 140 #define tlckFREE 0x0040 /* fre 141 #define tlckRELINK 0x0080 /* upd 142 143 /* 144 * linelock for lmLog() 145 * 146 * note: linelock and its variations are overl 147 * at tlock.lock: watch for alignment; 148 */ 149 struct lv { 150 u8 offset; /* 1: */ 151 u8 length; /* 1: */ 152 }; /* (2) */ 153 154 #define TLOCKSHORT 20 155 #define TLOCKLONG 28 156 157 struct linelock { 158 lid_t next; /* 2: next lin 159 160 s8 maxcnt; /* 1: */ 161 s8 index; /* 1: */ 162 163 u16 flag; /* 2: */ 164 u8 type; /* 1: */ 165 u8 l2linesize; /* 1: log2 of 166 /* (8) */ 167 168 struct lv lv[20]; /* 40: */ 169 }; /* (48) */ 170 171 #define dt_lock linelock 172 173 struct xtlock { 174 lid_t next; /* 2: */ 175 176 s8 maxcnt; /* 1: */ 177 s8 index; /* 1: */ 178 179 u16 flag; /* 2: */ 180 u8 type; /* 1: */ 181 u8 l2linesize; /* 1: log2 of 182 /* (8) */ 183 184 struct lv header; /* 2: */ 185 struct lv lwm; /* 2: low wate 186 struct lv hwm; /* 2: high wat 187 struct lv twm; /* 2: */ 188 /* (16) */ 189 190 s32 pxdlock[8]; /* 32: */ 191 }; /* (48) */ 192 193 194 /* 195 * maplock for txUpdateMap() 196 * 197 * note: maplock and its variations are overla 198 * at tlock.lock/linelock: watch for alignment 199 * N.B. next field may be set by linelock, and 200 * be modified by maplock; 201 * N.B. index of the first pxdlock specifies i 202 * free maplock (i.e., number of maplock) in t 203 */ 204 struct maplock { 205 lid_t next; /* 2: */ 206 207 u8 maxcnt; /* 2: */ 208 u8 index; /* 2: next fre 209 210 u16 flag; /* 2: */ 211 u8 type; /* 1: */ 212 u8 count; /* 1: number o 213 /* (8) */ 214 215 pxd_t pxd; /* 8: */ 216 }; /* (16): */ 217 218 /* maplock flag */ 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 232 struct xdlistlock { 233 lid_t next; /* 2: */ 234 235 u8 maxcnt; /* 2: */ 236 u8 index; /* 2: */ 237 238 u16 flag; /* 2: */ 239 u8 type; /* 1: */ 240 u8 count; /* 1: number o 241 /* (8) */ 242 243 /* 244 * We need xdlist to be 64 bits (8 byt 245 * whether void * is 32 or 64 bits 246 */ 247 union { 248 void *_xdlist; /* pxd/xad lis 249 s64 pad; /* 8: Force 64 250 } union64; 251 }; /* (16): */ 252 253 #define xdlist union64._xdlist 254 255 /* 256 * commit 257 * 258 * parameter to the commit manager routines 259 */ 260 struct commit { 261 tid_t tid; /* tid = index 262 int flag; /* flags */ 263 struct jfs_log *log; /* log */ 264 struct super_block *sb; /* superblock 265 266 int nip; /* number of e 267 struct inode **iplist; /* list of poi 268 269 /* log record descriptor on 64-bit bou 270 struct lrd lrd; /* : log recor 271 }; 272 273 /* 274 * external declarations 275 */ 276 extern int jfs_tlocks_low; 277 278 extern int txInit(void); 279 extern void txExit(void); 280 extern struct tlock *txLock(tid_t, struct inod 281 extern struct tlock *txMaplock(tid_t, struct i 282 extern int txCommit(tid_t, int, struct inode * 283 extern tid_t txBegin(struct super_block *, int 284 extern void txBeginAnon(struct super_block *); 285 extern void txEnd(tid_t); 286 extern void txAbort(tid_t, int); 287 extern struct linelock *txLinelock(struct line 288 extern void txFreeMap(struct inode *, struct m 289 extern void txEA(tid_t, struct inode *, dxd_t 290 extern void txFreelock(struct inode *); 291 extern int lmLog(struct jfs_log *, struct tblo 292 struct tlock *); 293 extern void txQuiesce(struct super_block *); 294 extern void txResume(struct super_block *); 295 extern void txLazyUnlock(struct tblock *); 296 extern int jfs_lazycommit(void *); 297 extern int jfs_sync(void *); 298 #endif /* _H_JFS_TXNM 299
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.