]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/xfs_trans.h
Merge of xfs-cmds-2.4.18:slinx:111473a by nathans.
[thirdparty/xfsprogs-dev.git] / include / xfs_trans.h
CommitLineData
2bd0ea18
NS
1/*
2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32#ifndef __XFS_TRANS_H__
33#define __XFS_TRANS_H__
34
35/*
36 * This is the structure written in the log at the head of
37 * every transaction. It identifies the type and id of the
38 * transaction, and contains the number of items logged by
39 * the transaction so we know how many to expect during recovery.
40 *
41 * Do not change the below structure without redoing the code in
42 * xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans().
43 */
44typedef struct xfs_trans_header {
45 uint th_magic; /* magic number */
46 uint th_type; /* transaction type */
47 __int32_t th_tid; /* transaction id (unused) */
48 uint th_num_items; /* num items logged by trans */
49} xfs_trans_header_t;
50
51#define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */
52
53/*
54 * Log item types.
55 */
56#define XFS_LI_5_3_BUF 0x1234 /* v1 bufs, 1-block inode buffers */
57#define XFS_LI_5_3_INODE 0x1235 /* 1-block inode buffers */
58#define XFS_LI_EFI 0x1236
59#define XFS_LI_EFD 0x1237
60#define XFS_LI_IUNLINK 0x1238
61#define XFS_LI_6_1_INODE 0x1239 /* 4K non-aligned inode bufs */
62#define XFS_LI_6_1_BUF 0x123a /* v1, 4K inode buffers */
63#define XFS_LI_INODE 0x123b /* aligned ino chunks, var-size ibufs */
64#define XFS_LI_BUF 0x123c /* v2 bufs, variable sized inode bufs */
65#define XFS_LI_DQUOT 0x123d
66#define XFS_LI_QUOTAOFF 0x123e
67#define XFS_LI_RPC 0x123f /* CXFS RPC return info */
68
69/*
70 * Transaction types. Used to distinguish types of buffers.
71 */
72#define XFS_TRANS_SETATTR_NOT_SIZE 1
73#define XFS_TRANS_SETATTR_SIZE 2
74#define XFS_TRANS_INACTIVE 3
75#define XFS_TRANS_CREATE 4
76#define XFS_TRANS_CREATE_TRUNC 5
77#define XFS_TRANS_TRUNCATE_FILE 6
78#define XFS_TRANS_REMOVE 7
79#define XFS_TRANS_LINK 8
80#define XFS_TRANS_RENAME 9
81#define XFS_TRANS_MKDIR 10
82#define XFS_TRANS_RMDIR 11
83#define XFS_TRANS_SYMLINK 12
84#define XFS_TRANS_SET_DMATTRS 13
85#define XFS_TRANS_GROWFS 14
86#define XFS_TRANS_STRAT_WRITE 15
87#define XFS_TRANS_DIOSTRAT 16
88#define XFS_TRANS_WRITE_SYNC 17
89#define XFS_TRANS_WRITEID 18
90#define XFS_TRANS_ADDAFORK 19
91#define XFS_TRANS_ATTRINVAL 20
92#define XFS_TRANS_ATRUNCATE 21
93#define XFS_TRANS_ATTR_SET 22
94#define XFS_TRANS_ATTR_RM 23
95#define XFS_TRANS_ATTR_FLAG 24
96#define XFS_TRANS_CLEAR_AGI_BUCKET 25
97#define XFS_TRANS_QM_SBCHANGE 26
98/*
99 * Dummy entries since we use the transaction type to index into the
100 * trans_type[] in xlog_recover_print_trans_head()
101 */
102#define XFS_TRANS_DUMMY1 27
103#define XFS_TRANS_DUMMY2 28
104#define XFS_TRANS_QM_QUOTAOFF 29
105#define XFS_TRANS_QM_DQALLOC 30
106#define XFS_TRANS_QM_SETQLIM 31
107#define XFS_TRANS_QM_DQCLUSTER 32
108#define XFS_TRANS_QM_QINOCREATE 33
109#define XFS_TRANS_QM_QUOTAOFF_END 34
110#define XFS_TRANS_SB_UNIT 35
111#define XFS_TRANS_FSYNC_TS 36
112#define XFS_TRANS_GROWFSRT_ALLOC 37
113#define XFS_TRANS_GROWFSRT_ZERO 38
114#define XFS_TRANS_GROWFSRT_FREE 39
115#define XFS_TRANS_SWAPEXT 40
116/* new transaction types need to be reflected in xfs_logprint(8) */
117
118
119#ifdef __KERNEL__
120struct xfs_buf;
121struct buftarg;
122struct xfs_efd_log_item;
123struct xfs_efi_log_item;
124struct xfs_inode;
125struct xfs_item_ops;
126struct xfs_log_iovec;
127struct xfs_log_item;
128struct xfs_log_item_desc;
129struct xfs_mount;
130struct xfs_trans;
131struct xfs_dquot_acct;
132
133typedef struct xfs_ail_entry {
134 struct xfs_log_item *ail_forw; /* AIL forw pointer */
135 struct xfs_log_item *ail_back; /* AIL back pointer */
136} xfs_ail_entry_t;
137
138/*
139 * This structure is passed as a parameter to xfs_trans_push_ail()
140 * and is used to track the what LSN the waiting processes are
141 * waiting to become unused.
142 */
143typedef struct xfs_ail_ticket {
144 xfs_lsn_t at_lsn; /* lsn waitin for */
145 struct xfs_ail_ticket *at_forw; /* wait list ptr */
146 struct xfs_ail_ticket *at_back; /* wait list ptr */
147 sv_t at_sema; /* wait sema */
148} xfs_ail_ticket_t;
149
150
151typedef struct xfs_log_item {
152 xfs_ail_entry_t li_ail; /* AIL pointers */
153 xfs_lsn_t li_lsn; /* last on-disk lsn */
154 struct xfs_log_item_desc *li_desc; /* ptr to current desc*/
155 struct xfs_mount *li_mountp; /* ptr to fs mount */
156 uint li_type; /* item type */
157 uint li_flags; /* misc flags */
158 struct xfs_log_item *li_bio_list; /* buffer item list */
159 void (*li_cb)(struct xfs_buf *,
160 struct xfs_log_item *);
161 /* buffer item iodone */
162 /* callback func */
163 struct xfs_item_ops *li_ops; /* function list */
164} xfs_log_item_t;
165
166#define XFS_LI_IN_AIL 0x1
167#define XFS_LI_ABORTED 0x2
168
169typedef struct xfs_item_ops {
170 uint (*iop_size)(xfs_log_item_t *);
171 void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *);
172 void (*iop_pin)(xfs_log_item_t *);
173 void (*iop_unpin)(xfs_log_item_t *);
174 void (*iop_unpin_remove)(xfs_log_item_t *, struct xfs_trans *);
175 uint (*iop_trylock)(xfs_log_item_t *);
176 void (*iop_unlock)(xfs_log_item_t *);
177 xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t);
178 void (*iop_push)(xfs_log_item_t *);
179 void (*iop_abort)(xfs_log_item_t *);
180 void (*iop_pushbuf)(xfs_log_item_t *);
181 void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
182} xfs_item_ops_t;
183
184#define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip)
185#define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp)
186#define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip)
187#define IOP_UNPIN(ip) (*(ip)->li_ops->iop_unpin)(ip)
188#define IOP_UNPIN_REMOVE(ip,tp) (*(ip)->li_ops->iop_unpin_remove)(ip, tp)
189#define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip)
190#define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip)
191#define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn)
192#define IOP_PUSH(ip) (*(ip)->li_ops->iop_push)(ip)
193#define IOP_ABORT(ip) (*(ip)->li_ops->iop_abort)(ip)
194#define IOP_PUSHBUF(ip) (*(ip)->li_ops->iop_pushbuf)(ip)
195#define IOP_COMMITTING(ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn)
196
197/*
198 * Return values for the IOP_TRYLOCK() routines.
199 */
200#define XFS_ITEM_SUCCESS 0
201#define XFS_ITEM_PINNED 1
202#define XFS_ITEM_LOCKED 2
203#define XFS_ITEM_FLUSHING 3
204#define XFS_ITEM_PUSHBUF 4
205
206#endif /* __KERNEL__ */
207
208/*
209 * This structure is used to track log items associated with
210 * a transaction. It points to the log item and keeps some
211 * flags to track the state of the log item. It also tracks
212 * the amount of space needed to log the item it describes
213 * once we get to commit processing (see xfs_trans_commit()).
214 */
215typedef struct xfs_log_item_desc {
216 xfs_log_item_t *lid_item;
217 ushort lid_size;
218 unsigned char lid_flags;
219 unsigned char lid_index;
220} xfs_log_item_desc_t;
221
222#define XFS_LID_DIRTY 0x1
223#define XFS_LID_PINNED 0x2
224#define XFS_LID_SYNC_UNLOCK 0x4
225
226/*
227 * This structure is used to maintain a chunk list of log_item_desc
228 * structures. The free field is a bitmask indicating which descriptors
229 * in this chunk's array are free. The unused field is the first value
230 * not used since this chunk was allocated.
231 */
232#define XFS_LIC_NUM_SLOTS 15
233typedef struct xfs_log_item_chunk {
234 struct xfs_log_item_chunk *lic_next;
235 ushort lic_free;
236 ushort lic_unused;
237 xfs_log_item_desc_t lic_descs[XFS_LIC_NUM_SLOTS];
238} xfs_log_item_chunk_t;
239
240#define XFS_LIC_MAX_SLOT (XFS_LIC_NUM_SLOTS - 1)
241#define XFS_LIC_FREEMASK ((1 << XFS_LIC_NUM_SLOTS) - 1)
242
243
244/*
245 * Initialize the given chunk. Set the chunk's free descriptor mask
246 * to indicate that all descriptors are free. The caller gets to set
247 * lic_unused to the right value (0 matches all free). The
248 * lic_descs.lid_index values are set up as each desc is allocated.
249 */
250#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT)
251void xfs_lic_init(xfs_log_item_chunk_t *cp);
252#define XFS_LIC_INIT(cp) xfs_lic_init(cp)
253#else
254#define XFS_LIC_INIT(cp) ((cp)->lic_free = XFS_LIC_FREEMASK)
255#endif
256#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT_SLOT)
257void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot);
258#define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot)
259#else
260#define XFS_LIC_INIT_SLOT(cp,slot) \
261 ((cp)->lic_descs[slot].lid_index = (unsigned char)(slot))
262#endif
263#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_VACANCY)
264int xfs_lic_vacancy(xfs_log_item_chunk_t *cp);
265#define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp)
266#else
267#define XFS_LIC_VACANCY(cp) (((cp)->lic_free) & XFS_LIC_FREEMASK)
268#endif
269#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ALL_FREE)
270void xfs_lic_all_free(xfs_log_item_chunk_t *cp);
271#define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp)
272#else
273#define XFS_LIC_ALL_FREE(cp) ((cp)->lic_free = XFS_LIC_FREEMASK)
274#endif
275#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ARE_ALL_FREE)
276int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp);
277#define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp)
278#else
279#define XFS_LIC_ARE_ALL_FREE(cp) (((cp)->lic_free & XFS_LIC_FREEMASK) ==\
280 XFS_LIC_FREEMASK)
281#endif
282#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ISFREE)
283int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot);
284#define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot)
285#else
286#define XFS_LIC_ISFREE(cp,slot) ((cp)->lic_free & (1 << (slot)))
287#endif
288#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_CLAIM)
289void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot);
290#define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot)
291#else
292#define XFS_LIC_CLAIM(cp,slot) ((cp)->lic_free &= ~(1 << (slot)))
293#endif
294#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_RELSE)
295void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot);
296#define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot)
297#else
298#define XFS_LIC_RELSE(cp,slot) ((cp)->lic_free |= 1 << (slot))
299#endif
300#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_SLOT)
301xfs_log_item_desc_t *xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot);
302#define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot)
303#else
304#define XFS_LIC_SLOT(cp,slot) (&((cp)->lic_descs[slot]))
305#endif
306#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_SLOT)
307int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp);
308#define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp)
309#else
310#define XFS_LIC_DESC_TO_SLOT(dp) ((uint)((dp)->lid_index))
311#endif
312/*
313 * Calculate the address of a chunk given a descriptor pointer:
314 * dp - dp->lid_index give the address of the start of the lic_descs array.
315 * From this we subtract the offset of the lic_descs field in a chunk.
316 * All of this yields the address of the chunk, which is
317 * cast to a chunk pointer.
318 */
319#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_CHUNK)
320xfs_log_item_chunk_t *xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp);
321#define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp)
322#else
323#define XFS_LIC_DESC_TO_CHUNK(dp) ((xfs_log_item_chunk_t*) \
324 (((xfs_caddr_t)((dp) - (dp)->lid_index)) -\
325 (xfs_caddr_t)(((xfs_log_item_chunk_t*) \
326 0)->lic_descs)))
327#endif
328
329#ifdef __KERNEL__
330/*
331 * This is the type of function which can be given to xfs_trans_callback()
332 * to be called upon the transaction's commit to disk.
333 */
334typedef void (*xfs_trans_callback_t)(struct xfs_trans *, void *);
335
336/*
337 * This is the structure maintained for every active transaction.
338 */
339typedef struct xfs_trans {
340 unsigned int t_magic; /* magic number */
341 xfs_log_callback_t t_logcb; /* log callback struct */
342 struct xfs_trans *t_forw; /* async list pointers */
343 struct xfs_trans *t_back; /* async list pointers */
344 unsigned int t_type; /* transaction type */
345 unsigned int t_log_res; /* amt of log space resvd */
346 unsigned int t_log_count; /* count for perm log res */
347 unsigned int t_blk_res; /* # of blocks resvd */
348 unsigned int t_blk_res_used; /* # of resvd blocks used */
349 unsigned int t_rtx_res; /* # of rt extents resvd */
350 unsigned int t_rtx_res_used; /* # of resvd rt extents used */
351 xfs_log_ticket_t t_ticket; /* log mgr ticket */
352 sema_t t_sema; /* sema for commit completion */
353 xfs_lsn_t t_lsn; /* log seq num of trans commit*/
354 struct xfs_mount *t_mountp; /* ptr to fs mount struct */
355 struct xfs_dquot_acct *t_dqinfo; /* accting info for dquots */
356 xfs_trans_callback_t t_callback; /* transaction callback */
357 void *t_callarg; /* callback arg */
358 unsigned int t_flags; /* misc flags */
359 long t_icount_delta; /* superblock icount change */
360 long t_ifree_delta; /* superblock ifree change */
361 long t_fdblocks_delta; /* superblock fdblocks chg */
362 long t_res_fdblocks_delta; /* on-disk only chg */
363 long t_frextents_delta;/* superblock freextents chg*/
364 long t_res_frextents_delta; /* on-disk only chg */
365 long t_ag_freeblks_delta; /* debugging counter */
366 long t_ag_flist_delta; /* debugging counter */
367 long t_ag_btree_delta; /* debugging counter */
368 long t_dblocks_delta;/* superblock dblocks change */
369 long t_agcount_delta;/* superblock agcount change */
370 long t_imaxpct_delta;/* superblock imaxpct change */
371 long t_rextsize_delta;/* superblock rextsize chg */
372 long t_rbmblocks_delta;/* superblock rbmblocks chg */
373 long t_rblocks_delta;/* superblock rblocks change */
374 long t_rextents_delta;/* superblocks rextents chg */
375 long t_rextslog_delta;/* superblocks rextslog chg */
376 unsigned int t_items_free; /* log item descs free */
377 xfs_log_item_chunk_t t_items; /* first log item desc chunk */
378 xfs_trans_header_t t_header; /* header for in-log trans */
379} xfs_trans_t;
380
381#endif /* __KERNEL__ */
382
383
384#define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */
385/*
386 * Values for t_flags.
387 */
388#define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */
389#define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */
390#define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */
391#define XFS_TRANS_SYNC 0x08 /* make commit synchronous */
392#define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty */
393#define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */
394
395/*
396 * Values for call flags parameter.
397 */
398#define XFS_TRANS_NOSLEEP 0x1
399#define XFS_TRANS_WAIT 0x2
400#define XFS_TRANS_RELEASE_LOG_RES 0x4
401#define XFS_TRANS_ABORT 0x8
402
403/*
404 * Field values for xfs_trans_mod_sb.
405 */
406#define XFS_TRANS_SB_ICOUNT 0x00000001
407#define XFS_TRANS_SB_IFREE 0x00000002
408#define XFS_TRANS_SB_FDBLOCKS 0x00000004
409#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008
410#define XFS_TRANS_SB_FREXTENTS 0x00000010
411#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020
412#define XFS_TRANS_SB_DBLOCKS 0x00000040
413#define XFS_TRANS_SB_AGCOUNT 0x00000080
414#define XFS_TRANS_SB_IMAXPCT 0x00000100
415#define XFS_TRANS_SB_REXTSIZE 0x00000200
416#define XFS_TRANS_SB_RBMBLOCKS 0x00000400
417#define XFS_TRANS_SB_RBLOCKS 0x00000800
418#define XFS_TRANS_SB_REXTENTS 0x00001000
419#define XFS_TRANS_SB_REXTSLOG 0x00002000
420
421
422/*
423 * Various log reservation values.
424 * These are based on the size of the file system block
425 * because that is what most transactions manipulate.
426 * Each adds in an additional 128 bytes per item logged to
427 * try to account for the overhead of the transaction mechanism.
428 *
429 * Note:
430 * Most of the reservations underestimate the number of allocation
431 * groups into which they could free extents in the xfs_bmap_finish()
432 * call. This is because the number in the worst case is quite high
433 * and quite unusual. In order to fix this we need to change
434 * xfs_bmap_finish() to free extents in only a single AG at a time.
435 * This will require changes to the EFI code as well, however, so that
436 * the EFI for the extents not freed is logged again in each transaction.
437 * See bug 261917.
438 */
439
440/*
441 * Per-extent log reservation for the allocation btree changes
442 * involved in freeing or allocating an extent.
443 * 2 trees * (2 blocks/level * max depth - 1) * block size
444 */
445#define XFS_ALLOCFREE_LOG_RES(mp,nx) \
446 ((nx) * (2 * XFS_FSB_TO_B((mp), 2 * XFS_AG_MAXLEVELS(mp) - 1)))
447#define XFS_ALLOCFREE_LOG_COUNT(mp,nx) \
448 ((nx) * (2 * (2 * XFS_AG_MAXLEVELS(mp) - 1)))
449
450/*
451 * Per-directory log reservation for any directory change.
452 * dir blocks: (1 btree block per level + data block + free block) * dblock size
453 * bmap btree: (levels + 2) * max depth * block size
454 * v2 directory blocks can be fragmented below the dirblksize down to the fsb
455 * size, so account for that in the DAENTER macros.
456 */
457#define XFS_DIROP_LOG_RES(mp) \
458 (XFS_FSB_TO_B(mp, XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK)) + \
459 (XFS_FSB_TO_B(mp, XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)))
460#define XFS_DIROP_LOG_COUNT(mp) \
461 (XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \
462 XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)
463
464/*
465 * In a write transaction we can allocate a maximum of 2
466 * extents. This gives:
467 * the inode getting the new extents: inode size
468 * the inode\'s bmap btree: max depth * block size
469 * the agfs of the ags from which the extents are allocated: 2 * sector
470 * the superblock free block counter: sector size
471 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
472 * And the bmap_finish transaction can free bmap blocks in a join:
473 * the agfs of the ags containing the blocks: 2 * sector size
474 * the agfls of the ags containing the blocks: 2 * sector size
475 * the super block free block counter: sector size
476 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
477 */
478#define XFS_CALC_WRITE_LOG_RES(mp) \
479 (MAX( \
480 ((mp)->m_sb.sb_inodesize + \
481 XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \
482 (2 * (mp)->m_sb.sb_sectsize) + \
483 (mp)->m_sb.sb_sectsize + \
484 XFS_ALLOCFREE_LOG_RES(mp, 2) + \
485 (128 * (4 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))),\
486 ((2 * (mp)->m_sb.sb_sectsize) + \
487 (2 * (mp)->m_sb.sb_sectsize) + \
488 (mp)->m_sb.sb_sectsize + \
489 XFS_ALLOCFREE_LOG_RES(mp, 2) + \
490 (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
491
492#define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write)
493
494/*
495 * In truncating a file we free up to two extents at once. We can modify:
496 * the inode being truncated: inode size
497 * the inode\'s bmap btree: (max depth + 1) * block size
498 * And the bmap_finish transaction can free the blocks and bmap blocks:
499 * the agf for each of the ags: 4 * sector size
500 * the agfl for each of the ags: 4 * sector size
501 * the super block to reflect the freed blocks: sector size
502 * worst case split in allocation btrees per extent assuming 4 extents:
503 * 4 exts * 2 trees * (2 * max depth - 1) * block size
504 */
505#define XFS_CALC_ITRUNCATE_LOG_RES(mp) \
506 (MAX( \
507 ((mp)->m_sb.sb_inodesize + \
508 XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) + \
509 (128 * (2 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)))), \
510 ((4 * (mp)->m_sb.sb_sectsize) + \
511 (4 * (mp)->m_sb.sb_sectsize) + \
512 (mp)->m_sb.sb_sectsize + \
513 XFS_ALLOCFREE_LOG_RES(mp, 4) + \
514 (128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))))))
515
516#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate)
517
518/*
519 * In renaming a files we can modify:
520 * the four inodes involved: 4 * inode size
521 * the two directory btrees: 2 * (max depth + v2) * dir block size
522 * the two directory bmap btrees: 2 * max depth * block size
523 * And the bmap_finish transaction can free dir and bmap blocks (two sets
524 * of bmap blocks) giving:
525 * the agf for the ags in which the blocks live: 3 * sector size
526 * the agfl for the ags in which the blocks live: 3 * sector size
527 * the superblock for the free block count: sector size
528 * the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size
529 */
530#define XFS_CALC_RENAME_LOG_RES(mp) \
531 (MAX( \
532 ((4 * (mp)->m_sb.sb_inodesize) + \
533 (2 * XFS_DIROP_LOG_RES(mp)) + \
534 (128 * (4 + 2 * XFS_DIROP_LOG_COUNT(mp)))), \
535 ((3 * (mp)->m_sb.sb_sectsize) + \
536 (3 * (mp)->m_sb.sb_sectsize) + \
537 (mp)->m_sb.sb_sectsize + \
538 XFS_ALLOCFREE_LOG_RES(mp, 3) + \
539 (128 * (7 + XFS_ALLOCFREE_LOG_COUNT(mp, 3))))))
540
541#define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename)
542
543/*
544 * For creating a link to an inode:
545 * the parent directory inode: inode size
546 * the linked inode: inode size
547 * the directory btree could split: (max depth + v2) * dir block size
548 * the directory bmap btree could join or split: (max depth + v2) * blocksize
549 * And the bmap_finish transaction can free some bmap blocks giving:
550 * the agf for the ag in which the blocks live: sector size
551 * the agfl for the ag in which the blocks live: sector size
552 * the superblock for the free block count: sector size
553 * the allocation btrees: 2 trees * (2 * max depth - 1) * block size
554 */
555#define XFS_CALC_LINK_LOG_RES(mp) \
556 (MAX( \
557 ((mp)->m_sb.sb_inodesize + \
558 (mp)->m_sb.sb_inodesize + \
559 XFS_DIROP_LOG_RES(mp) + \
560 (128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \
561 ((mp)->m_sb.sb_sectsize + \
562 (mp)->m_sb.sb_sectsize + \
563 (mp)->m_sb.sb_sectsize + \
564 XFS_ALLOCFREE_LOG_RES(mp, 1) + \
565 (128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
566
567#define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link)
568
569/*
570 * For removing a directory entry we can modify:
571 * the parent directory inode: inode size
572 * the removed inode: inode size
573 * the directory btree could join: (max depth + v2) * dir block size
574 * the directory bmap btree could join or split: (max depth + v2) * blocksize
575 * And the bmap_finish transaction can free the dir and bmap blocks giving:
576 * the agf for the ag in which the blocks live: 2 * sector size
577 * the agfl for the ag in which the blocks live: 2 * sector size
578 * the superblock for the free block count: sector size
579 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
580 */
581#define XFS_CALC_REMOVE_LOG_RES(mp) \
582 (MAX( \
583 ((mp)->m_sb.sb_inodesize + \
584 (mp)->m_sb.sb_inodesize + \
585 XFS_DIROP_LOG_RES(mp) + \
586 (128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \
587 ((2 * (mp)->m_sb.sb_sectsize) + \
588 (2 * (mp)->m_sb.sb_sectsize) + \
589 (mp)->m_sb.sb_sectsize + \
590 XFS_ALLOCFREE_LOG_RES(mp, 2) + \
591 (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
592
593#define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove)
594
595/*
596 * For symlink we can modify:
597 * the parent directory inode: inode size
598 * the new inode: inode size
599 * the inode btree entry: 1 block
600 * the directory btree: (max depth + v2) * dir block size
601 * the directory inode\'s bmap btree: (max depth + v2) * block size
602 * the blocks for the symlink: 1 KB
603 * Or in the first xact we allocate some inodes giving:
604 * the agi and agf of the ag getting the new inodes: 2 * sectorsize
605 * the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize
606 * the inode btree: max depth * blocksize
607 * the allocation btrees: 2 trees * (2 * max depth - 1) * block size
608 */
609#define XFS_CALC_SYMLINK_LOG_RES(mp) \
610 (MAX( \
611 ((mp)->m_sb.sb_inodesize + \
612 (mp)->m_sb.sb_inodesize + \
613 XFS_FSB_TO_B(mp, 1) + \
614 XFS_DIROP_LOG_RES(mp) + \
615 1024 + \
616 (128 * (4 + XFS_DIROP_LOG_COUNT(mp)))), \
617 (2 * (mp)->m_sb.sb_sectsize + \
618 XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
619 XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \
620 XFS_ALLOCFREE_LOG_RES(mp, 1) + \
621 (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
622 XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
623
624#define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink)
625
626/*
627 * For create we can modify:
628 * the parent directory inode: inode size
629 * the new inode: inode size
630 * the inode btree entry: block size
631 * the superblock for the nlink flag: sector size
632 * the directory btree: (max depth + v2) * dir block size
633 * the directory inode\'s bmap btree: (max depth + v2) * block size
634 * Or in the first xact we allocate some inodes giving:
635 * the agi and agf of the ag getting the new inodes: 2 * sectorsize
636 * the superblock for the nlink flag: sector size
637 * the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize
638 * the inode btree: max depth * blocksize
639 * the allocation btrees: 2 trees * (max depth - 1) * block size
640 */
641#define XFS_CALC_CREATE_LOG_RES(mp) \
642 (MAX( \
643 ((mp)->m_sb.sb_inodesize + \
644 (mp)->m_sb.sb_inodesize + \
645 (mp)->m_sb.sb_sectsize + \
646 XFS_FSB_TO_B(mp, 1) + \
647 XFS_DIROP_LOG_RES(mp) + \
648 (128 * (3 + XFS_DIROP_LOG_COUNT(mp)))), \
649 (3 * (mp)->m_sb.sb_sectsize + \
650 XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
651 XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \
652 XFS_ALLOCFREE_LOG_RES(mp, 1) + \
653 (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
654 XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
655
656#define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create)
657
658/*
659 * Making a new directory is the same as creating a new file.
660 */
661#define XFS_CALC_MKDIR_LOG_RES(mp) XFS_CALC_CREATE_LOG_RES(mp)
662
663#define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir)
664
665/*
666 * In freeing an inode we can modify:
667 * the inode being freed: inode size
668 * the super block free inode counter: sector size
669 * the agi hash list and counters: sector size
670 * the inode btree entry: block size
671 * the on disk inode before ours in the agi hash list: inode cluster size
672 */
673#define XFS_CALC_IFREE_LOG_RES(mp) \
674 ((mp)->m_sb.sb_inodesize + \
675 (mp)->m_sb.sb_sectsize + \
676 (mp)->m_sb.sb_sectsize + \
677 XFS_FSB_TO_B((mp), 1) + \
7dcc1612 678 MAX((__uint16_t)XFS_FSB_TO_B((mp), 1), XFS_INODE_CLUSTER_SIZE(mp)) + \
2bd0ea18
NS
679 (128 * 5))
680
681#define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree)
682
683/*
684 * When only changing the inode we log the inode and possibly the superblock
685 * We also add a bit of slop for the transaction stuff.
686 */
687#define XFS_CALC_ICHANGE_LOG_RES(mp) ((mp)->m_sb.sb_inodesize + \
688 (mp)->m_sb.sb_sectsize + 512)
689
690#define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange)
691
692/*
693 * Growing the data section of the filesystem.
694 * superblock
695 * agi and agf
696 * allocation btrees
697 */
698#define XFS_CALC_GROWDATA_LOG_RES(mp) \
699 ((mp)->m_sb.sb_sectsize * 3 + \
700 XFS_ALLOCFREE_LOG_RES(mp, 1) + \
701 (128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
702
703#define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata)
704
705/*
706 * Growing the rt section of the filesystem.
707 * In the first set of transactions (ALLOC) we allocate space to the
708 * bitmap or summary files.
709 * superblock: sector size
710 * agf of the ag from which the extent is allocated: sector size
711 * bmap btree for bitmap/summary inode: max depth * blocksize
712 * bitmap/summary inode: inode size
713 * allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize
714 */
715#define XFS_CALC_GROWRTALLOC_LOG_RES(mp) \
716 (2 * (mp)->m_sb.sb_sectsize + \
717 XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \
718 (mp)->m_sb.sb_inodesize + \
719 XFS_ALLOCFREE_LOG_RES(mp, 1) + \
720 (128 * \
721 (3 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + \
722 XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
723
724#define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc)
725
726/*
727 * Growing the rt section of the filesystem.
728 * In the second set of transactions (ZERO) we zero the new metadata blocks.
729 * one bitmap/summary block: blocksize
730 */
731#define XFS_CALC_GROWRTZERO_LOG_RES(mp) \
732 ((mp)->m_sb.sb_blocksize + 128)
733
734#define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero)
735
736/*
737 * Growing the rt section of the filesystem.
738 * In the third set of transactions (FREE) we update metadata without
739 * allocating any new blocks.
740 * superblock: sector size
741 * bitmap inode: inode size
742 * summary inode: inode size
743 * one bitmap block: blocksize
744 * summary blocks: new summary size
745 */
746#define XFS_CALC_GROWRTFREE_LOG_RES(mp) \
747 ((mp)->m_sb.sb_sectsize + \
748 2 * (mp)->m_sb.sb_inodesize + \
749 (mp)->m_sb.sb_blocksize + \
750 (mp)->m_rsumsize + \
751 (128 * 5))
752
753#define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree)
754
755/*
756 * Logging the inode modification timestamp on a synchronous write.
757 * inode
758 */
759#define XFS_CALC_SWRITE_LOG_RES(mp) \
760 ((mp)->m_sb.sb_inodesize + 128)
761
762#define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
763
764/*
765 * Logging the inode timestamps on an fsync -- same as SWRITE
766 * as long as SWRITE logs the entire inode core
767 */
768#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
769
770/*
771 * Logging the inode mode bits when writing a setuid/setgid file
772 * inode
773 */
774#define XFS_CALC_WRITEID_LOG_RES(mp) \
775 ((mp)->m_sb.sb_inodesize + 128)
776
777#define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
778
779/*
780 * Converting the inode from non-attributed to attributed.
781 * the inode being converted: inode size
782 * agf block and superblock (for block allocation)
783 * the new block (directory sized)
784 * bmap blocks for the new directory block
785 * allocation btrees
786 */
787#define XFS_CALC_ADDAFORK_LOG_RES(mp) \
788 ((mp)->m_sb.sb_inodesize + \
789 (mp)->m_sb.sb_sectsize * 2 + \
790 (mp)->m_dirblksize + \
791 (XFS_DIR_IS_V1(mp) ? 0 : \
792 XFS_FSB_TO_B(mp, (XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1))) + \
793 XFS_ALLOCFREE_LOG_RES(mp, 1) + \
794 (128 * (4 + \
795 (XFS_DIR_IS_V1(mp) ? 0 : \
796 XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1) + \
797 XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
798
799#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork)
800
801/*
802 * Removing the attribute fork of a file
803 * the inode being truncated: inode size
804 * the inode\'s bmap btree: max depth * block size
805 * And the bmap_finish transaction can free the blocks and bmap blocks:
806 * the agf for each of the ags: 4 * sector size
807 * the agfl for each of the ags: 4 * sector size
808 * the super block to reflect the freed blocks: sector size
809 * worst case split in allocation btrees per extent assuming 4 extents:
810 * 4 exts * 2 trees * (2 * max depth - 1) * block size
811 */
812#define XFS_CALC_ATTRINVAL_LOG_RES(mp) \
813 (MAX( \
814 ((mp)->m_sb.sb_inodesize + \
815 XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \
816 (128 * (1 + XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)))), \
817 ((4 * (mp)->m_sb.sb_sectsize) + \
818 (4 * (mp)->m_sb.sb_sectsize) + \
819 (mp)->m_sb.sb_sectsize + \
820 XFS_ALLOCFREE_LOG_RES(mp, 4) + \
821 (128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))))))
822
823#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval)
824
825/*
826 * Setting an attribute.
827 * the inode getting the attribute
828 * the superblock for allocations
829 * the agfs extents are allocated from
830 * the attribute btree * max depth
831 * the inode allocation btree
832 * Since attribute transaction space is dependent on the size of the attribute,
833 * the calculation is done partially at mount time and partially at runtime.
834 */
835#define XFS_CALC_ATTRSET_LOG_RES(mp) \
836 ((mp)->m_sb.sb_inodesize + \
837 (mp)->m_sb.sb_sectsize + \
838 XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \
839 (128 * (2 + XFS_DA_NODE_MAXDEPTH)))
840
841#define XFS_ATTRSET_LOG_RES(mp, ext) \
842 ((mp)->m_reservations.tr_attrset + \
843 (ext * (mp)->m_sb.sb_sectsize) + \
844 (ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \
845 (128 * (ext + (ext * XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)))))
846
847/*
848 * Removing an attribute.
849 * the inode: inode size
850 * the attribute btree could join: max depth * block size
851 * the inode bmap btree could join or split: max depth * block size
852 * And the bmap_finish transaction can free the attr blocks freed giving:
853 * the agf for the ag in which the blocks live: 2 * sector size
854 * the agfl for the ag in which the blocks live: 2 * sector size
855 * the superblock for the free block count: sector size
856 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
857 */
858#define XFS_CALC_ATTRRM_LOG_RES(mp) \
859 (MAX( \
860 ((mp)->m_sb.sb_inodesize + \
861 XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \
862 XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \
863 (128 * (1 + XFS_DA_NODE_MAXDEPTH + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)))), \
864 ((2 * (mp)->m_sb.sb_sectsize) + \
865 (2 * (mp)->m_sb.sb_sectsize) + \
866 (mp)->m_sb.sb_sectsize + \
867 XFS_ALLOCFREE_LOG_RES(mp, 2) + \
868 (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
869
870#define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm)
871
872/*
873 * Clearing a bad agino number in an agi hash bucket.
874 */
875#define XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp) \
876 ((mp)->m_sb.sb_sectsize + 128)
877
878#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi)
879
880
881/*
882 * Various log count values.
883 */
884#define XFS_DEFAULT_LOG_COUNT 1
885#define XFS_DEFAULT_PERM_LOG_COUNT 2
886#define XFS_ITRUNCATE_LOG_COUNT 2
887#define XFS_CREATE_LOG_COUNT 2
888#define XFS_MKDIR_LOG_COUNT 3
889#define XFS_SYMLINK_LOG_COUNT 3
890#define XFS_REMOVE_LOG_COUNT 2
891#define XFS_LINK_LOG_COUNT 2
892#define XFS_RENAME_LOG_COUNT 2
893#define XFS_WRITE_LOG_COUNT 2
894#define XFS_ADDAFORK_LOG_COUNT 2
895#define XFS_ATTRINVAL_LOG_COUNT 1
896#define XFS_ATTRSET_LOG_COUNT 3
897#define XFS_ATTRRM_LOG_COUNT 3
898
899/*
900 * Here we centralize the specification of XFS meta-data buffer
901 * reference count values. This determine how hard the buffer
902 * cache tries to hold onto the buffer.
903 */
904#define XFS_AGF_REF 4
905#define XFS_AGI_REF 4
906#define XFS_AGFL_REF 3
907#define XFS_INO_BTREE_REF 3
908#define XFS_ALLOC_BTREE_REF 2
909#define XFS_BMAP_BTREE_REF 2
910#define XFS_DIR_BTREE_REF 2
911#define XFS_ATTR_BTREE_REF 1
912#define XFS_INO_REF 1
913#define XFS_DQUOT_REF 1
914
915#ifdef __KERNEL__
916/*
917 * XFS transaction mechanism exported interfaces that are
918 * actually macros.
919 */
920#define xfs_trans_get_log_res(tp) ((tp)->t_log_res)
921#define xfs_trans_get_log_count(tp) ((tp)->t_log_count)
922#define xfs_trans_get_block_res(tp) ((tp)->t_blk_res)
923#define xfs_trans_set_sync(tp) ((tp)->t_flags |= XFS_TRANS_SYNC)
924
925#ifdef DEBUG
926#define xfs_trans_agblocks_delta(tp, d) ((tp)->t_ag_freeblks_delta += (long)d)
927#define xfs_trans_agflist_delta(tp, d) ((tp)->t_ag_flist_delta += (long)d)
928#define xfs_trans_agbtree_delta(tp, d) ((tp)->t_ag_btree_delta += (long)d)
929#else
930#define xfs_trans_agblocks_delta(tp, d)
931#define xfs_trans_agflist_delta(tp, d)
932#define xfs_trans_agbtree_delta(tp, d)
933#endif
934
935/*
936 * XFS transaction mechanism exported interfaces.
937 */
938void xfs_trans_init(struct xfs_mount *);
939xfs_trans_t *xfs_trans_alloc(struct xfs_mount *, uint);
d460bf32 940xfs_trans_t *_xfs_trans_alloc(struct xfs_mount *, uint);
2bd0ea18
NS
941xfs_trans_t *xfs_trans_dup(xfs_trans_t *);
942int xfs_trans_reserve(xfs_trans_t *, uint, uint, uint,
943 uint, uint);
944void xfs_trans_callback(xfs_trans_t *,
945 void (*)(xfs_trans_t *, void *), void *);
946void xfs_trans_mod_sb(xfs_trans_t *, uint, long);
947struct xfs_buf *xfs_trans_get_buf(xfs_trans_t *, struct buftarg *, xfs_daddr_t,
948 int, uint);
949int xfs_trans_read_buf(struct xfs_mount *, xfs_trans_t *,
950 struct buftarg *, xfs_daddr_t, int, uint,
951 struct xfs_buf **);
952struct xfs_buf *xfs_trans_getsb(xfs_trans_t *, struct xfs_mount *, int);
953
954void xfs_trans_brelse(xfs_trans_t *, struct xfs_buf *);
955void xfs_trans_bjoin(xfs_trans_t *, struct xfs_buf *);
956void xfs_trans_bhold(xfs_trans_t *, struct xfs_buf *);
957void xfs_trans_bhold_until_committed(xfs_trans_t *, struct xfs_buf *);
958void xfs_trans_binval(xfs_trans_t *, struct xfs_buf *);
959void xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *);
960void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint);
961void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *);
962int xfs_trans_iget(struct xfs_mount *, xfs_trans_t *,
963 xfs_ino_t , uint, struct xfs_inode **);
964void xfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint);
965void xfs_trans_ijoin(xfs_trans_t *, struct xfs_inode *, uint);
966void xfs_trans_ihold(xfs_trans_t *, struct xfs_inode *);
967void xfs_trans_ihold_release(xfs_trans_t *, struct xfs_inode *);
968void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint);
969void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint);
970struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint);
971void xfs_efi_release(struct xfs_efi_log_item *, uint);
972void xfs_trans_log_efi_extent(xfs_trans_t *,
973 struct xfs_efi_log_item *,
974 xfs_fsblock_t,
975 xfs_extlen_t);
976struct xfs_efd_log_item *xfs_trans_get_efd(xfs_trans_t *,
977 struct xfs_efi_log_item *,
978 uint);
979void xfs_trans_log_efd_extent(xfs_trans_t *,
980 struct xfs_efd_log_item *,
981 xfs_fsblock_t,
982 xfs_extlen_t);
983void xfs_trans_log_create_rpc(xfs_trans_t *, int, xfs_ino_t);
984void xfs_trans_log_setattr_rpc(xfs_trans_t *, int);
985int xfs_trans_commit(xfs_trans_t *, uint flags, xfs_lsn_t *);
986void xfs_trans_commit_async(struct xfs_mount *);
987void xfs_trans_cancel(xfs_trans_t *, int);
988void xfs_trans_ail_init(struct xfs_mount *);
989xfs_lsn_t xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t);
990xfs_lsn_t xfs_trans_tail_ail(struct xfs_mount *);
991void xfs_trans_unlocked_item(struct xfs_mount *,
992 xfs_log_item_t *);
993
994/*
995 * Not necessarily exported, but used outside a single file.
996 */
997int xfs_trans_lsn_danger(struct xfs_mount *, xfs_lsn_t);
998
999#endif /* __KERNEL__ */
1000
1001#endif /* __XFS_TRANS_H__ */