This source file includes following definitions.
- xfs_log_calc_max_attrsetm_res
- xfs_log_get_max_trans_res
- xfs_log_calc_minimum_size
1
2
3
4
5
6 #include "xfs.h"
7 #include "xfs_fs.h"
8 #include "xfs_shared.h"
9 #include "xfs_format.h"
10 #include "xfs_log_format.h"
11 #include "xfs_trans_resv.h"
12 #include "xfs_mount.h"
13 #include "xfs_da_format.h"
14 #include "xfs_trans_space.h"
15 #include "xfs_da_btree.h"
16 #include "xfs_bmap_btree.h"
17
18
19
20
21
22 STATIC int
23 xfs_log_calc_max_attrsetm_res(
24 struct xfs_mount *mp)
25 {
26 int size;
27 int nblks;
28
29 size = xfs_attr_leaf_entsize_local_max(mp->m_attr_geo->blksize) -
30 MAXNAMELEN - 1;
31 nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK);
32 nblks += XFS_B_TO_FSB(mp, size);
33 nblks += XFS_NEXTENTADD_SPACE_RES(mp, size, XFS_ATTR_FORK);
34
35 return M_RES(mp)->tr_attrsetm.tr_logres +
36 M_RES(mp)->tr_attrsetrt.tr_logres * nblks;
37 }
38
39
40
41
42
43
44 void
45 xfs_log_get_max_trans_res(
46 struct xfs_mount *mp,
47 struct xfs_trans_res *max_resp)
48 {
49 struct xfs_trans_res *resp;
50 struct xfs_trans_res *end_resp;
51 int log_space = 0;
52 int attr_space;
53
54 attr_space = xfs_log_calc_max_attrsetm_res(mp);
55
56 resp = (struct xfs_trans_res *)M_RES(mp);
57 end_resp = (struct xfs_trans_res *)(M_RES(mp) + 1);
58 for (; resp < end_resp; resp++) {
59 int tmp = resp->tr_logcount > 1 ?
60 resp->tr_logres * resp->tr_logcount :
61 resp->tr_logres;
62 if (log_space < tmp) {
63 log_space = tmp;
64 *max_resp = *resp;
65 }
66 }
67
68 if (attr_space > log_space) {
69 *max_resp = M_RES(mp)->tr_attrsetm;
70 max_resp->tr_logres = attr_space;
71 }
72 }
73
74
75
76
77
78
79
80 int
81 xfs_log_calc_minimum_size(
82 struct xfs_mount *mp)
83 {
84 struct xfs_trans_res tres = {0};
85 int max_logres;
86 int min_logblks = 0;
87 int lsunit = 0;
88
89 xfs_log_get_max_trans_res(mp, &tres);
90
91 max_logres = xfs_log_calc_unit_res(mp, tres.tr_logres);
92 if (tres.tr_logcount > 1)
93 max_logres *= tres.tr_logcount;
94
95 if (xfs_sb_version_haslogv2(&mp->m_sb) && mp->m_sb.sb_logsunit > 1)
96 lsunit = BTOBB(mp->m_sb.sb_logsunit);
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126 if (lsunit) {
127 min_logblks = roundup_64(BTOBB(max_logres), lsunit) +
128 2 * lsunit;
129 } else
130 min_logblks = BTOBB(max_logres) + 2 * BBSIZE;
131 min_logblks *= XFS_MIN_LOG_FACTOR;
132
133 return XFS_BB_TO_FSB(mp, min_logblks);
134 }