Linux Audio

Check our new training course

Loading...
v4.17
 
  1/*
  2 *   Copyright (C) International Business Machines Corp., 2000-2004
  3 *
  4 *   This program is free software;  you can redistribute it and/or modify
  5 *   it under the terms of the GNU General Public License as published by
  6 *   the Free Software Foundation; either version 2 of the License, or
  7 *   (at your option) any later version.
  8 *
  9 *   This program is distributed in the hope that it will be useful,
 10 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
 11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 12 *   the GNU General Public License for more details.
 13 *
 14 *   You should have received a copy of the GNU General Public License
 15 *   along with this program;  if not, write to the Free Software
 16 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17 */
 18#ifndef _H_JFS_TXNMGR
 19#define _H_JFS_TXNMGR
 20
 21#include "jfs_logmgr.h"
 22
 23/*
 24 * Hide implementation of TxBlock and TxLock
 25 */
 26#define tid_to_tblock(tid) (&TxBlock[tid])
 27
 28#define lid_to_tlock(lid) (&TxLock[lid])
 29
 30/*
 31 *	transaction block
 32 */
 33struct tblock {
 34	/*
 35	 * tblock and jbuf_t common area: struct logsyncblk
 36	 *
 37	 * the following 5 fields are the same as struct logsyncblk
 38	 * which is common to tblock and jbuf to form logsynclist
 39	 */
 40	u16 xflag;		/* tx commit type */
 41	u16 flag;		/* tx commit state */
 42	lid_t dummy;		/* Must keep structures common */
 43	s32 lsn;		/* recovery lsn */
 44	struct list_head synclist;	/* logsynclist link */
 45
 46	/* lock management */
 47	struct super_block *sb;	/* super block */
 48	lid_t next;		/* index of first tlock of tid */
 49	lid_t last;		/* index of last tlock of tid */
 50	wait_queue_head_t waitor;	/* tids waiting on this tid */
 51
 52	/* log management */
 53	u32 logtid;		/* log transaction id */
 54
 55	/* commit management */
 56	struct list_head cqueue;	/* commit queue list */
 57	s32 clsn;		/* commit lsn */
 58	struct lbuf *bp;
 59	s32 pn;			/* commit record log page number */
 60	s32 eor;		/* commit record eor */
 61	wait_queue_head_t gcwait;	/* group commit event list:
 62					 * ready transactions wait on this
 63					 * event for group commit completion.
 64					 */
 65	union {
 66		struct inode *ip; /* inode being deleted */
 67		pxd_t ixpxd;	/* pxd of inode extent for created inode */
 68	} u;
 69	u32 ino;		/* inode number being created */
 70};
 71
 72extern struct tblock *TxBlock;	/* transaction block table */
 73
 74/* commit flags: tblk->xflag */
 75#define	COMMIT_SYNC	0x0001	/* synchronous commit */
 76#define	COMMIT_FORCE	0x0002	/* force pageout at end of commit */
 77#define	COMMIT_FLUSH	0x0004	/* init flush at end of commit */
 78#define COMMIT_MAP	0x00f0
 79#define	COMMIT_PMAP	0x0010	/* update pmap */
 80#define	COMMIT_WMAP	0x0020	/* update wmap */
 81#define	COMMIT_PWMAP	0x0040	/* update pwmap */
 82#define	COMMIT_FREE	0x0f00
 83#define	COMMIT_DELETE	0x0100	/* inode delete */
 84#define	COMMIT_TRUNCATE	0x0200	/* file truncation */
 85#define	COMMIT_CREATE	0x0400	/* inode create */
 86#define	COMMIT_LAZY	0x0800	/* lazy commit */
 87#define COMMIT_PAGE	0x1000	/* Identifies element as metapage */
 88#define COMMIT_INODE	0x2000	/* Identifies element as inode */
 89
 90/* group commit flags tblk->flag: see jfs_logmgr.h */
 91
 92/*
 93 *	transaction lock
 94 */
 95struct tlock {
 96	lid_t next;		/* 2: index next lockword on tid locklist
 97				 *	    next lockword on freelist
 98				 */
 99	tid_t tid;		/* 2: transaction id holding lock */
100
101	u16 flag;		/* 2: lock control */
102	u16 type;		/* 2: log type */
103
104	struct metapage *mp;	/* 4/8: object page buffer locked */
105	struct inode *ip;	/* 4/8: object */
106	/* (16) */
107
108	s16 lock[24];		/* 48: overlay area */
109};				/* (64) */
110
111extern struct tlock *TxLock;	/* transaction lock table */
112
113/*
114 * tlock flag
115 */
116/* txLock state */
117#define tlckPAGELOCK		0x8000
118#define tlckINODELOCK		0x4000
119#define tlckLINELOCK		0x2000
120#define tlckINLINELOCK		0x1000
121/* lmLog state */
122#define tlckLOG			0x0800
123/* updateMap state */
124#define	tlckUPDATEMAP		0x0080
125#define	tlckDIRECTORY		0x0040
126/* freeLock state */
127#define tlckFREELOCK		0x0008
128#define tlckWRITEPAGE		0x0004
129#define tlckFREEPAGE		0x0002
130
131/*
132 * tlock type
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	/* file grow */
146#define tlckREMOVE		0x0002	/* file delete */
147#define tlckTRUNCATE		0x0004	/* file truncate */
148#define tlckRELOCATE		0x0008	/* file/directory relocate */
149#define tlckENTRY		0x0001	/* directory insert/delete */
150#define tlckEXTEND		0x0002	/* directory extend in-line */
151#define tlckSPLIT		0x0010	/* splited page */
152#define tlckNEW			0x0020	/* new page from split */
153#define tlckFREE		0x0040	/* free page */
154#define tlckRELINK		0x0080	/* update sibling pointer */
155
156/*
157 *	linelock for lmLog()
158 *
159 * note: linelock and its variations are overlaid
160 * at tlock.lock: watch for alignment;
161 */
162struct lv {
163	u8 offset;		/* 1: */
164	u8 length;		/* 1: */
165};				/* (2) */
166
167#define	TLOCKSHORT	20
168#define	TLOCKLONG	28
169
170struct linelock {
171	lid_t next;		/* 2: next linelock */
172
173	s8 maxcnt;		/* 1: */
174	s8 index;		/* 1: */
175
176	u16 flag;		/* 2: */
177	u8 type;		/* 1: */
178	u8 l2linesize;		/* 1: log2 of linesize */
179	/* (8) */
180
181	struct lv lv[20];	/* 40: */
182};				/* (48) */
183
184#define dt_lock	linelock
185
186struct xtlock {
187	lid_t next;		/* 2: */
188
189	s8 maxcnt;		/* 1: */
190	s8 index;		/* 1: */
191
192	u16 flag;		/* 2: */
193	u8 type;		/* 1: */
194	u8 l2linesize;		/* 1: log2 of linesize */
195				/* (8) */
196
197	struct lv header;	/* 2: */
198	struct lv lwm;		/* 2: low water mark */
199	struct lv hwm;		/* 2: high water mark */
200	struct lv twm;		/* 2: */
201				/* (16) */
202
203	s32 pxdlock[8];		/* 32: */
204};				/* (48) */
205
206
207/*
208 *	maplock for txUpdateMap()
209 *
210 * note: maplock and its variations are overlaid
211 * at tlock.lock/linelock: watch for alignment;
212 * N.B. next field may be set by linelock, and should not
213 * be modified by maplock;
214 * N.B. index of the first pxdlock specifies index of next
215 * free maplock (i.e., number of maplock) in the tlock;
216 */
217struct maplock {
218	lid_t next;		/* 2: */
219
220	u8 maxcnt;		/* 2: */
221	u8 index;		/* 2: next free maplock index */
222
223	u16 flag;		/* 2: */
224	u8 type;		/* 1: */
225	u8 count;		/* 1: number of pxd/xad */
226				/* (8) */
227
228	pxd_t pxd;		/* 8: */
229};				/* (16): */
230
231/* maplock flag */
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;		/* 2: */
247
248	u8 maxcnt;		/* 2: */
249	u8 index;		/* 2: */
250
251	u16 flag;		/* 2: */
252	u8 type;		/* 1: */
253	u8 count;		/* 1: number of pxd/xad */
254				/* (8) */
255
256	/*
257	 * We need xdlist to be 64 bits (8 bytes), regardless of
258	 * whether void * is 32 or 64 bits
259	 */
260	union {
261		void *_xdlist;	/* pxd/xad list */
262		s64 pad;	/* 8: Force 64-bit xdlist size */
263	} union64;
264};				/* (16): */
265
266#define xdlist union64._xdlist
267
268/*
269 *	commit
270 *
271 * parameter to the commit manager routines
272 */
273struct commit {
274	tid_t tid;		/* tid = index of tblock */
275	int flag;		/* flags */
276	struct jfs_log *log;	/* log */
277	struct super_block *sb;	/* superblock */
278
279	int nip;		/* number of entries in iplist */
280	struct inode **iplist;	/* list of pointers to inodes */
281
282	/* log record descriptor on 64-bit boundary */
283	struct lrd lrd;		/* : log record descriptor */
284};
285
286/*
287 * external declarations
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				/* _H_JFS_TXNMGR */
v5.9
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 *   Copyright (C) International Business Machines Corp., 2000-2004
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  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 */
 20struct tblock {
 21	/*
 22	 * tblock and jbuf_t common area: struct logsyncblk
 23	 *
 24	 * the following 5 fields are the same as struct logsyncblk
 25	 * which is common to tblock and jbuf to form logsynclist
 26	 */
 27	u16 xflag;		/* tx commit type */
 28	u16 flag;		/* tx commit state */
 29	lid_t dummy;		/* Must keep structures common */
 30	s32 lsn;		/* recovery lsn */
 31	struct list_head synclist;	/* logsynclist link */
 32
 33	/* lock management */
 34	struct super_block *sb;	/* super block */
 35	lid_t next;		/* index of first tlock of tid */
 36	lid_t last;		/* index of last tlock of tid */
 37	wait_queue_head_t waitor;	/* tids waiting on this tid */
 38
 39	/* log management */
 40	u32 logtid;		/* log transaction id */
 41
 42	/* commit management */
 43	struct list_head cqueue;	/* commit queue list */
 44	s32 clsn;		/* commit lsn */
 45	struct lbuf *bp;
 46	s32 pn;			/* commit record log page number */
 47	s32 eor;		/* commit record eor */
 48	wait_queue_head_t gcwait;	/* group commit event list:
 49					 * ready transactions wait on this
 50					 * event for group commit completion.
 51					 */
 52	union {
 53		struct inode *ip; /* inode being deleted */
 54		pxd_t ixpxd;	/* pxd of inode extent for created inode */
 55	} u;
 56	u32 ino;		/* inode number being created */
 57};
 58
 59extern struct tblock *TxBlock;	/* transaction block table */
 60
 61/* commit flags: tblk->xflag */
 62#define	COMMIT_SYNC	0x0001	/* synchronous commit */
 63#define	COMMIT_FORCE	0x0002	/* force pageout at end of commit */
 64#define	COMMIT_FLUSH	0x0004	/* init flush at end of commit */
 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 pwmap */
 69#define	COMMIT_FREE	0x0f00
 70#define	COMMIT_DELETE	0x0100	/* inode delete */
 71#define	COMMIT_TRUNCATE	0x0200	/* file truncation */
 72#define	COMMIT_CREATE	0x0400	/* inode create */
 73#define	COMMIT_LAZY	0x0800	/* lazy commit */
 74#define COMMIT_PAGE	0x1000	/* Identifies element as metapage */
 75#define COMMIT_INODE	0x2000	/* Identifies element as inode */
 76
 77/* group commit flags tblk->flag: see jfs_logmgr.h */
 78
 79/*
 80 *	transaction lock
 81 */
 82struct tlock {
 83	lid_t next;		/* 2: index next lockword on tid locklist
 84				 *	    next lockword on freelist
 85				 */
 86	tid_t tid;		/* 2: transaction id holding lock */
 87
 88	u16 flag;		/* 2: lock control */
 89	u16 type;		/* 2: log type */
 90
 91	struct metapage *mp;	/* 4/8: object page buffer locked */
 92	struct inode *ip;	/* 4/8: object */
 93	/* (16) */
 94
 95	s16 lock[24];		/* 48: overlay area */
 96};				/* (64) */
 97
 98extern struct tlock *TxLock;	/* transaction lock table */
 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	/* file grow */
133#define tlckREMOVE		0x0002	/* file delete */
134#define tlckTRUNCATE		0x0004	/* file truncate */
135#define tlckRELOCATE		0x0008	/* file/directory relocate */
136#define tlckENTRY		0x0001	/* directory insert/delete */
137#define tlckEXTEND		0x0002	/* directory extend in-line */
138#define tlckSPLIT		0x0010	/* splited page */
139#define tlckNEW			0x0020	/* new page from split */
140#define tlckFREE		0x0040	/* free page */
141#define tlckRELINK		0x0080	/* update sibling pointer */
142
143/*
144 *	linelock for lmLog()
145 *
146 * note: linelock and its variations are overlaid
147 * at tlock.lock: watch for alignment;
148 */
149struct lv {
150	u8 offset;		/* 1: */
151	u8 length;		/* 1: */
152};				/* (2) */
153
154#define	TLOCKSHORT	20
155#define	TLOCKLONG	28
156
157struct linelock {
158	lid_t next;		/* 2: next linelock */
159
160	s8 maxcnt;		/* 1: */
161	s8 index;		/* 1: */
162
163	u16 flag;		/* 2: */
164	u8 type;		/* 1: */
165	u8 l2linesize;		/* 1: log2 of linesize */
166	/* (8) */
167
168	struct lv lv[20];	/* 40: */
169};				/* (48) */
170
171#define dt_lock	linelock
172
173struct 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 linesize */
182				/* (8) */
183
184	struct lv header;	/* 2: */
185	struct lv lwm;		/* 2: low water mark */
186	struct lv hwm;		/* 2: high water mark */
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 overlaid
198 * at tlock.lock/linelock: watch for alignment;
199 * N.B. next field may be set by linelock, and should not
200 * be modified by maplock;
201 * N.B. index of the first pxdlock specifies index of next
202 * free maplock (i.e., number of maplock) in the tlock;
203 */
204struct maplock {
205	lid_t next;		/* 2: */
206
207	u8 maxcnt;		/* 2: */
208	u8 index;		/* 2: next free maplock index */
209
210	u16 flag;		/* 2: */
211	u8 type;		/* 1: */
212	u8 count;		/* 1: number of pxd/xad */
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
232struct 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 of pxd/xad */
241				/* (8) */
242
243	/*
244	 * We need xdlist to be 64 bits (8 bytes), regardless of
245	 * whether void * is 32 or 64 bits
246	 */
247	union {
248		void *_xdlist;	/* pxd/xad list */
249		s64 pad;	/* 8: Force 64-bit xdlist size */
250	} union64;
251};				/* (16): */
252
253#define xdlist union64._xdlist
254
255/*
256 *	commit
257 *
258 * parameter to the commit manager routines
259 */
260struct commit {
261	tid_t tid;		/* tid = index of tblock */
262	int flag;		/* flags */
263	struct jfs_log *log;	/* log */
264	struct super_block *sb;	/* superblock */
265
266	int nip;		/* number of entries in iplist */
267	struct inode **iplist;	/* list of pointers to inodes */
268
269	/* log record descriptor on 64-bit boundary */
270	struct lrd lrd;		/* : log record descriptor */
271};
272
273/*
274 * external declarations
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				/* _H_JFS_TXNMGR */