diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-08-12 06:49:32 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-12 17:36:16 -0400 |
commit | 7fd36c4418ee86712db6871ac95ab23743224bff (patch) | |
tree | 8f449f4eba8c31a16362e8640089489aa7579eff /fs/xfs/xfs_trans.h | |
parent | d386b32b553ce145fb40f0d9360b6e5a79b5a80c (diff) |
xfs: split out transaction reservation code
The transaction reservation size calculations is used by both kernel
and userspace, but most of the transaction code in xfs_trans.c is
kernel specific. Split all the transaction reservation code out into
it's own files to make sharing with userspace simpler. This just
leaves kernel-only definitions in xfs_trans.h, so it doesn't need to
be shared with userspace anymore, either.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans.h')
-rw-r--r-- | fs/xfs/xfs_trans.h | 77 |
1 files changed, 2 insertions, 75 deletions
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 772d5aed90fa..b5dc61e3e56b 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -20,80 +20,9 @@ | |||
20 | 20 | ||
21 | struct xfs_log_item; | 21 | struct xfs_log_item; |
22 | 22 | ||
23 | /* | 23 | #include "xfs_trans_resv.h" |
24 | * Per-extent log reservation for the allocation btree changes | ||
25 | * involved in freeing or allocating an extent. | ||
26 | * 2 trees * (2 blocks/level * max depth - 1) | ||
27 | */ | ||
28 | #define XFS_ALLOCFREE_LOG_COUNT(mp,nx) \ | ||
29 | ((nx) * (2 * (2 * XFS_AG_MAXLEVELS(mp) - 1))) | ||
30 | 24 | ||
31 | /* | 25 | /* kernel only transaction subsystem defines */ |
32 | * Per-directory log reservation for any directory change. | ||
33 | * dir blocks: (1 btree block per level + data block + free block) | ||
34 | * bmap btree: (levels + 2) * max depth | ||
35 | * v2 directory blocks can be fragmented below the dirblksize down to the fsb | ||
36 | * size, so account for that in the DAENTER macros. | ||
37 | */ | ||
38 | #define XFS_DIROP_LOG_COUNT(mp) \ | ||
39 | (XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \ | ||
40 | XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1) | ||
41 | |||
42 | |||
43 | #define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write) | ||
44 | #define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate) | ||
45 | #define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename) | ||
46 | #define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link) | ||
47 | #define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove) | ||
48 | #define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink) | ||
49 | #define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create) | ||
50 | #define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir) | ||
51 | #define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree) | ||
52 | #define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange) | ||
53 | #define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata) | ||
54 | #define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc) | ||
55 | #define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero) | ||
56 | #define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree) | ||
57 | #define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | ||
58 | /* | ||
59 | * Logging the inode timestamps on an fsync -- same as SWRITE | ||
60 | * as long as SWRITE logs the entire inode core | ||
61 | */ | ||
62 | #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | ||
63 | #define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | ||
64 | #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) | ||
65 | #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) | ||
66 | #define XFS_ATTRSETM_LOG_RES(mp) ((mp)->m_reservations.tr_attrsetm) | ||
67 | #define XFS_ATTRSETRT_LOG_RES(mp) ((mp)->m_reservations.tr_attrsetrt) | ||
68 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) | ||
69 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) | ||
70 | #define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_qm_sbchange) | ||
71 | #define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_reservations.tr_qm_setqlim) | ||
72 | #define XFS_QM_DQALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_qm_dqalloc) | ||
73 | #define XFS_QM_QUOTAOFF_LOG_RES(mp) ((mp)->m_reservations.tr_qm_quotaoff) | ||
74 | #define XFS_QM_QUOTAOFF_END_LOG_RES(mp) ((mp)->m_reservations.tr_qm_equotaoff) | ||
75 | #define XFS_SB_LOG_RES(mp) ((mp)->m_reservations.tr_sb) | ||
76 | |||
77 | /* | ||
78 | * Various log count values. | ||
79 | */ | ||
80 | #define XFS_DEFAULT_LOG_COUNT 1 | ||
81 | #define XFS_DEFAULT_PERM_LOG_COUNT 2 | ||
82 | #define XFS_ITRUNCATE_LOG_COUNT 2 | ||
83 | #define XFS_INACTIVE_LOG_COUNT 2 | ||
84 | #define XFS_CREATE_LOG_COUNT 2 | ||
85 | #define XFS_MKDIR_LOG_COUNT 3 | ||
86 | #define XFS_SYMLINK_LOG_COUNT 3 | ||
87 | #define XFS_REMOVE_LOG_COUNT 2 | ||
88 | #define XFS_LINK_LOG_COUNT 2 | ||
89 | #define XFS_RENAME_LOG_COUNT 2 | ||
90 | #define XFS_WRITE_LOG_COUNT 2 | ||
91 | #define XFS_ADDAFORK_LOG_COUNT 2 | ||
92 | #define XFS_ATTRINVAL_LOG_COUNT 1 | ||
93 | #define XFS_ATTRSET_LOG_COUNT 3 | ||
94 | #define XFS_ATTRRM_LOG_COUNT 3 | ||
95 | |||
96 | #ifdef __KERNEL__ | ||
97 | 26 | ||
98 | struct xfs_buf; | 27 | struct xfs_buf; |
99 | struct xfs_buftarg; | 28 | struct xfs_buftarg; |
@@ -323,6 +252,4 @@ void xfs_trans_ail_destroy(struct xfs_mount *); | |||
323 | extern kmem_zone_t *xfs_trans_zone; | 252 | extern kmem_zone_t *xfs_trans_zone; |
324 | extern kmem_zone_t *xfs_log_item_desc_zone; | 253 | extern kmem_zone_t *xfs_log_item_desc_zone; |
325 | 254 | ||
326 | #endif /* __KERNEL__ */ | ||
327 | |||
328 | #endif /* __XFS_TRANS_H__ */ | 255 | #endif /* __XFS_TRANS_H__ */ |