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