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