diff options
author | Jie Liu <jeff.liu@oracle.com> | 2013-08-12 06:49:56 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-12 18:45:49 -0400 |
commit | 0eadd1028858b193ce8cdc36bf443d39b42141ca (patch) | |
tree | 22f1624807ae9a75cc7adaf16a607e1f88ac0dd8 /fs/xfs/xfs_trans_resv.h | |
parent | 9356fe22af084e7b9c1f3c8633a1cbe9b36de405 (diff) |
xfs: Introduce a new structure to hold transaction reservation items
Introduce a new structure xfs_trans_res to hold transaction
reservation item info per log ticket.
We also need to improve xfs_trans_resv_calc() by initializing the
log count as well as log flags for permanent log reservation.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans_resv.h')
-rw-r--r-- | fs/xfs/xfs_trans_resv.h | 125 |
1 files changed, 68 insertions, 57 deletions
diff --git a/fs/xfs/xfs_trans_resv.h b/fs/xfs/xfs_trans_resv.h index cc8260e6acb2..0aac1fa9b383 100644 --- a/fs/xfs/xfs_trans_resv.h +++ b/fs/xfs/xfs_trans_resv.h | |||
@@ -23,35 +23,45 @@ struct xfs_mount; | |||
23 | /* | 23 | /* |
24 | * structure for maintaining pre-calculated transaction reservations. | 24 | * structure for maintaining pre-calculated transaction reservations. |
25 | */ | 25 | */ |
26 | struct xfs_trans_res { | ||
27 | uint tr_logres; /* log space unit in bytes per log ticket */ | ||
28 | int tr_logcount; /* number of log operations per log ticket */ | ||
29 | int tr_logflags; /* log flags, currently only used for indicating | ||
30 | * a reservation request is permanent or not */ | ||
31 | }; | ||
32 | |||
26 | struct xfs_trans_resv { | 33 | struct xfs_trans_resv { |
27 | uint tr_write; /* extent alloc trans */ | 34 | struct xfs_trans_res tr_write; /* extent alloc trans */ |
28 | uint tr_itruncate; /* truncate trans */ | 35 | struct xfs_trans_res tr_itruncate; /* truncate trans */ |
29 | uint tr_rename; /* rename trans */ | 36 | struct xfs_trans_res tr_rename; /* rename trans */ |
30 | uint tr_link; /* link trans */ | 37 | struct xfs_trans_res tr_link; /* link trans */ |
31 | uint tr_remove; /* unlink trans */ | 38 | struct xfs_trans_res tr_remove; /* unlink trans */ |
32 | uint tr_symlink; /* symlink trans */ | 39 | struct xfs_trans_res tr_symlink; /* symlink trans */ |
33 | uint tr_create; /* create trans */ | 40 | struct xfs_trans_res tr_create; /* create trans */ |
34 | uint tr_mkdir; /* mkdir trans */ | 41 | struct xfs_trans_res tr_mkdir; /* mkdir trans */ |
35 | uint tr_ifree; /* inode free trans */ | 42 | struct xfs_trans_res tr_ifree; /* inode free trans */ |
36 | uint tr_ichange; /* inode update trans */ | 43 | struct xfs_trans_res tr_ichange; /* inode update trans */ |
37 | uint tr_growdata; /* fs data section grow trans */ | 44 | struct xfs_trans_res tr_growdata; /* fs data section grow trans */ |
38 | uint tr_swrite; /* sync write inode trans */ | 45 | struct xfs_trans_res tr_swrite; /* sync write inode trans */ |
39 | uint tr_addafork; /* cvt inode to attributed trans */ | 46 | struct xfs_trans_res tr_addafork; /* add inode attr fork trans */ |
40 | uint tr_writeid; /* write setuid/setgid file */ | 47 | struct xfs_trans_res tr_writeid; /* write setuid/setgid file */ |
41 | uint tr_attrinval; /* attr fork buffer invalidation */ | 48 | struct xfs_trans_res tr_attrinval; /* attr fork buffer |
42 | uint tr_attrsetm; /* set/create an attribute at mount time */ | 49 | * invalidation */ |
43 | uint tr_attrsetrt; /* set/create an attribute at runtime */ | 50 | struct xfs_trans_res tr_attrsetm; /* set/create an attribute at |
44 | uint tr_attrrm; /* remove an attribute */ | 51 | * mount time */ |
45 | uint tr_clearagi; /* clear bad agi unlinked ino bucket */ | 52 | struct xfs_trans_res tr_attrsetrt; /* set/create an attribute at |
46 | uint tr_growrtalloc; /* grow realtime allocations */ | 53 | * runtime */ |
47 | uint tr_growrtzero; /* grow realtime zeroing */ | 54 | struct xfs_trans_res tr_attrrm; /* remove an attribute */ |
48 | uint tr_growrtfree; /* grow realtime freeing */ | 55 | struct xfs_trans_res tr_clearagi; /* clear agi unlinked bucket */ |
49 | uint tr_qm_sbchange; /* change quota flags */ | 56 | struct xfs_trans_res tr_growrtalloc; /* grow realtime allocations */ |
50 | uint tr_qm_setqlim; /* adjust quota limits */ | 57 | struct xfs_trans_res tr_growrtzero; /* grow realtime zeroing */ |
51 | uint tr_qm_dqalloc; /* allocate quota on disk */ | 58 | struct xfs_trans_res tr_growrtfree; /* grow realtime freeing */ |
52 | uint tr_qm_quotaoff; /* turn quota off */ | 59 | struct xfs_trans_res tr_qm_sbchange; /* change quota flags */ |
53 | uint tr_qm_equotaoff;/* end of turn quota off */ | 60 | struct xfs_trans_res tr_qm_setqlim; /* adjust quota limits */ |
54 | uint tr_sb; /* modify superblock */ | 61 | struct xfs_trans_res tr_qm_dqalloc; /* allocate quota on disk */ |
62 | struct xfs_trans_res tr_qm_quotaoff; /* turn quota off */ | ||
63 | struct xfs_trans_res tr_qm_equotaoff;/* end of turn quota off */ | ||
64 | struct xfs_trans_res tr_sb; /* modify superblock */ | ||
55 | }; | 65 | }; |
56 | 66 | ||
57 | /* | 67 | /* |
@@ -79,39 +89,40 @@ struct xfs_trans_resv { | |||
79 | XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1) | 89 | XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1) |
80 | 90 | ||
81 | 91 | ||
82 | #define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write) | 92 | #define XFS_WRITE_LOG_RES(mp) ((mp)->m_resv.tr_write.tr_logres) |
83 | #define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate) | 93 | #define XFS_RENAME_LOG_RES(mp) ((mp)->m_resv.tr_rename.tr_logres) |
84 | #define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename) | 94 | #define XFS_LINK_LOG_RES(mp) ((mp)->m_resv.tr_link.tr_logres) |
85 | #define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link) | 95 | #define XFS_REMOVE_LOG_RES(mp) ((mp)->m_resv.tr_remove.tr_logres) |
86 | #define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove) | 96 | #define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_resv.tr_symlink.tr_logres) |
87 | #define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink) | 97 | #define XFS_CREATE_LOG_RES(mp) ((mp)->m_resv.tr_create.tr_logres) |
88 | #define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create) | 98 | #define XFS_MKDIR_LOG_RES(mp) ((mp)->m_resv.tr_mkdir.tr_logres) |
89 | #define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir) | 99 | #define XFS_IFREE_LOG_RES(mp) ((mp)->m_resv.tr_ifree.tr_logres) |
90 | #define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree) | 100 | #define XFS_SWRITE_LOG_RES(mp) ((mp)->m_resv.tr_swrite.tr_logres) |
91 | #define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange) | 101 | #define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_resv.tr_ichange.tr_logres) |
92 | #define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata) | 102 | #define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_resv.tr_growdata.tr_logres) |
93 | #define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc) | 103 | #define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_resv.tr_itruncate.tr_logres) |
94 | #define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero) | 104 | #define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_resv.tr_growrtzero.tr_logres) |
95 | #define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree) | 105 | #define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_resv.tr_growrtfree.tr_logres) |
96 | #define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | 106 | #define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_resv.tr_growrtalloc.tr_logres) |
107 | |||
97 | /* | 108 | /* |
98 | * Logging the inode timestamps on an fsync -- same as SWRITE | 109 | * Logging the inode timestamps on an fsync -- same as SWRITE |
99 | * as long as SWRITE logs the entire inode core | 110 | * as long as SWRITE logs the entire inode core |
100 | */ | 111 | */ |
101 | #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | 112 | #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_resv.tr_swrite.tr_logres) |
102 | #define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | 113 | #define XFS_WRITEID_LOG_RES(mp) ((mp)->m_resv.tr_swrite.tr_logres) |
103 | #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) | 114 | #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_resv.tr_addafork.tr_logres) |
104 | #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) | 115 | #define XFS_ATTRSETM_LOG_RES(mp) ((mp)->m_resv.tr_attrsetm.tr_logres) |
105 | #define XFS_ATTRSETM_LOG_RES(mp) ((mp)->m_reservations.tr_attrsetm) | 116 | #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_resv.tr_attrinval.tr_logres) |
106 | #define XFS_ATTRSETRT_LOG_RES(mp) ((mp)->m_reservations.tr_attrsetrt) | 117 | #define XFS_ATTRSETRT_LOG_RES(mp) ((mp)->m_resv.tr_attrsetrt.tr_logres) |
107 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) | 118 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_resv.tr_attrrm.tr_logres) |
108 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) | 119 | #define XFS_SB_LOG_RES(mp) ((mp)->m_resv.tr_sb.tr_logres) |
109 | #define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_qm_sbchange) | 120 | #define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_resv.tr_qm_setqlim.tr_logres) |
110 | #define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_reservations.tr_qm_setqlim) | 121 | #define XFS_QM_DQALLOC_LOG_RES(mp) ((mp)->m_resv.tr_qm_dqalloc.tr_logres) |
111 | #define XFS_QM_DQALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_qm_dqalloc) | 122 | #define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_resv.tr_qm_sbchange.tr_logres) |
112 | #define XFS_QM_QUOTAOFF_LOG_RES(mp) ((mp)->m_reservations.tr_qm_quotaoff) | 123 | #define XFS_QM_QUOTAOFF_LOG_RES(mp) ((mp)->m_resv.tr_qm_quotaoff.tr_logres) |
113 | #define XFS_QM_QUOTAOFF_END_LOG_RES(mp) ((mp)->m_reservations.tr_qm_equotaoff) | 124 | #define XFS_QM_QUOTAOFF_END_LOG_RES(mp) ((mp)->m_resv.tr_qm_equotaoff.tr_logres) |
114 | #define XFS_SB_LOG_RES(mp) ((mp)->m_reservations.tr_sb) | 125 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_resv.tr_clearagi.tr_logres) |
115 | 126 | ||
116 | /* | 127 | /* |
117 | * Various log count values. | 128 | * Various log count values. |