blob: 19f3a226a3577d3a5094372c468dc07f43f8cc16 [file] [log] [blame]
Dave Chinner7fd36c42013-08-12 20:49:32 +10001/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * Copyright (C) 2010 Red Hat, Inc.
4 * All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it would be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include "xfs.h"
20#include "xfs_fs.h"
Dave Chinner70a98832013-10-23 10:36:05 +110021#include "xfs_shared.h"
Dave Chinner239880e2013-10-23 10:50:10 +110022#include "xfs_format.h"
23#include "xfs_log_format.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100024#include "xfs_trans_resv.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100025#include "xfs_mount.h"
Dave Chinner57062782013-10-15 09:17:51 +110026#include "xfs_da_format.h"
Dave Chinnerd6cf1302014-06-06 15:14:11 +100027#include "xfs_da_btree.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100028#include "xfs_inode.h"
Dave Chinnera4fbe6a2013-10-23 10:51:50 +110029#include "xfs_bmap_btree.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100030#include "xfs_ialloc.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100031#include "xfs_quota.h"
Dave Chinner239880e2013-10-23 10:50:10 +110032#include "xfs_trans.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100033#include "xfs_qm.h"
34#include "xfs_trans_space.h"
35#include "xfs_trace.h"
36
37/*
38 * A buffer has a format structure overhead in the log in addition
39 * to the data, so we need to take this into account when reserving
40 * space in a transaction for a buffer. Round the space required up
41 * to a multiple of 128 bytes so that we don't change the historical
42 * reservation that has been used for this overhead.
43 */
44STATIC uint
45xfs_buf_log_overhead(void)
46{
47 return round_up(sizeof(struct xlog_op_header) +
48 sizeof(struct xfs_buf_log_format), 128);
49}
50
51/*
52 * Calculate out transaction log reservation per item in bytes.
53 *
54 * The nbufs argument is used to indicate the number of items that
55 * will be changed in a transaction. size is used to tell how many
56 * bytes should be reserved per item.
57 */
58STATIC uint
59xfs_calc_buf_res(
60 uint nbufs,
61 uint size)
62{
63 return nbufs * (size + xfs_buf_log_overhead());
64}
65
66/*
Darrick J. Wongfa30f032016-08-03 11:37:10 +100067 * Per-extent log reservation for the btree changes involved in freeing or
68 * allocating an extent. In classic XFS there were two trees that will be
69 * modified (bnobt + cntbt). With rmap enabled, there are three trees
Darrick J. Wongf310bd22016-10-03 09:11:19 -070070 * (rmapbt). With reflink, there are four trees (refcountbt). The number of
71 * blocks reserved is based on the formula:
Darrick J. Wongfa30f032016-08-03 11:37:10 +100072 *
73 * num trees * ((2 blocks/level * max depth) - 1)
74 *
75 * Keep in mind that max depth is calculated separately for each type of tree.
76 */
Darrick J. Wong1946b912016-10-03 09:11:18 -070077uint
Darrick J. Wongfa30f032016-08-03 11:37:10 +100078xfs_allocfree_log_count(
79 struct xfs_mount *mp,
80 uint num_ops)
81{
82 uint blocks;
83
84 blocks = num_ops * 2 * (2 * mp->m_ag_maxlevels - 1);
85 if (xfs_sb_version_hasrmapbt(&mp->m_sb))
86 blocks += num_ops * (2 * mp->m_rmap_maxlevels - 1);
Darrick J. Wongf310bd22016-10-03 09:11:19 -070087 if (xfs_sb_version_hasreflink(&mp->m_sb))
88 blocks += num_ops * (2 * mp->m_refc_maxlevels - 1);
Darrick J. Wongfa30f032016-08-03 11:37:10 +100089
90 return blocks;
91}
92
93/*
Dave Chinner23956702013-08-28 16:10:35 +100094 * Logging inodes is really tricksy. They are logged in memory format,
95 * which means that what we write into the log doesn't directly translate into
96 * the amount of space they use on disk.
97 *
98 * Case in point - btree format forks in memory format use more space than the
99 * on-disk format. In memory, the buffer contains a normal btree block header so
100 * the btree code can treat it as though it is just another generic buffer.
101 * However, when we write it to the inode fork, we don't write all of this
102 * header as it isn't needed. e.g. the root is only ever in the inode, so
103 * there's no need for sibling pointers which would waste 16 bytes of space.
104 *
105 * Hence when we have an inode with a maximally sized btree format fork, then
106 * amount of information we actually log is greater than the size of the inode
107 * on disk. Hence we need an inode reservation function that calculates all this
108 * correctly. So, we log:
109 *
Dave Chinnerfe4c2242014-03-07 16:19:14 +1100110 * - 4 log op headers for object
111 * - for the ilf, the inode core and 2 forks
Dave Chinner23956702013-08-28 16:10:35 +1000112 * - inode log format object
Dave Chinnerfe4c2242014-03-07 16:19:14 +1100113 * - the inode core
114 * - two inode forks containing bmap btree root blocks.
115 * - the btree data contained by both forks will fit into the inode size,
116 * hence when combined with the inode core above, we have a total of the
117 * actual inode size.
118 * - the BMBT headers need to be accounted separately, as they are
119 * additional to the records and pointers that fit inside the inode
120 * forks.
Dave Chinner23956702013-08-28 16:10:35 +1000121 */
122STATIC uint
123xfs_calc_inode_res(
124 struct xfs_mount *mp,
125 uint ninodes)
126{
Dave Chinnerfe4c2242014-03-07 16:19:14 +1100127 return ninodes *
128 (4 * sizeof(struct xlog_op_header) +
129 sizeof(struct xfs_inode_log_format) +
130 mp->m_sb.sb_inodesize +
131 2 * XFS_BMBT_BLOCK_LEN(mp));
Dave Chinner23956702013-08-28 16:10:35 +1000132}
133
134/*
Brian Fosterf03c78f2018-01-08 10:41:37 -0800135 * Inode btree record insertion/removal modifies the inode btree and free space
136 * btrees (since the inobt does not use the agfl). This requires the following
137 * reservation:
Brian Foster9d43b182014-04-24 16:00:52 +1000138 *
Brian Fosterf03c78f2018-01-08 10:41:37 -0800139 * the inode btree: max depth * blocksize
Brian Foster9d43b182014-04-24 16:00:52 +1000140 * the allocation btrees: 2 trees * (max depth - 1) * block size
Brian Fosterf03c78f2018-01-08 10:41:37 -0800141 *
142 * The caller must account for SB and AG header modifications, etc.
143 */
144STATIC uint
145xfs_calc_inobt_res(
146 struct xfs_mount *mp)
147{
148 return xfs_calc_buf_res(mp->m_in_maxlevels, XFS_FSB_TO_B(mp, 1)) +
149 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
150 XFS_FSB_TO_B(mp, 1));
151}
152
153/*
154 * The free inode btree is a conditional feature. The behavior differs slightly
155 * from that of the traditional inode btree in that the finobt tracks records
156 * for inode chunks with at least one free inode. A record can be removed from
157 * the tree during individual inode allocation. Therefore the finobt
158 * reservation is unconditional for both the inode chunk allocation and
159 * individual inode allocation (modify) cases.
160 *
161 * Behavior aside, the reservation for finobt modification is equivalent to the
162 * traditional inobt: cover a full finobt shape change plus block allocation.
Brian Foster9d43b182014-04-24 16:00:52 +1000163 */
164STATIC uint
165xfs_calc_finobt_res(
Brian Fosterf03c78f2018-01-08 10:41:37 -0800166 struct xfs_mount *mp)
Brian Foster9d43b182014-04-24 16:00:52 +1000167{
Brian Foster9d43b182014-04-24 16:00:52 +1000168 if (!xfs_sb_version_hasfinobt(&mp->m_sb))
169 return 0;
170
Brian Fosterf03c78f2018-01-08 10:41:37 -0800171 return xfs_calc_inobt_res(mp);
Brian Foster9d43b182014-04-24 16:00:52 +1000172}
173
174/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000175 * Various log reservation values.
176 *
177 * These are based on the size of the file system block because that is what
178 * most transactions manipulate. Each adds in an additional 128 bytes per
179 * item logged to try to account for the overhead of the transaction mechanism.
180 *
181 * Note: Most of the reservations underestimate the number of allocation
Darrick J. Wong310a75a2016-08-03 11:18:10 +1000182 * groups into which they could free extents in the xfs_defer_finish() call.
Dave Chinner7fd36c42013-08-12 20:49:32 +1000183 * This is because the number in the worst case is quite high and quite
Darrick J. Wong310a75a2016-08-03 11:18:10 +1000184 * unusual. In order to fix this we need to change xfs_defer_finish() to free
Dave Chinner7fd36c42013-08-12 20:49:32 +1000185 * extents in only a single AG at a time. This will require changes to the
186 * EFI code as well, however, so that the EFI for the extents not freed is
187 * logged again in each transaction. See SGI PV #261917.
188 *
189 * Reservation functions here avoid a huge stack in xfs_trans_init due to
190 * register overflow from temporaries in the calculations.
191 */
192
193
194/*
195 * In a write transaction we can allocate a maximum of 2
196 * extents. This gives:
197 * the inode getting the new extents: inode size
198 * the inode's bmap btree: max depth * block size
199 * the agfs of the ags from which the extents are allocated: 2 * sector
200 * the superblock free block counter: sector size
201 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
202 * And the bmap_finish transaction can free bmap blocks in a join:
203 * the agfs of the ags containing the blocks: 2 * sector size
204 * the agfls of the ags containing the blocks: 2 * sector size
205 * the super block free block counter: sector size
206 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
207 */
208STATIC uint
209xfs_calc_write_reservation(
210 struct xfs_mount *mp)
211{
212 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000213 MAX((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000214 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK),
215 XFS_FSB_TO_B(mp, 1)) +
216 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000217 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 2),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000218 XFS_FSB_TO_B(mp, 1))),
219 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000220 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 2),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000221 XFS_FSB_TO_B(mp, 1))));
222}
223
224/*
225 * In truncating a file we free up to two extents at once. We can modify:
226 * the inode being truncated: inode size
227 * the inode's bmap btree: (max depth + 1) * block size
228 * And the bmap_finish transaction can free the blocks and bmap blocks:
229 * the agf for each of the ags: 4 * sector size
230 * the agfl for each of the ags: 4 * sector size
231 * the super block to reflect the freed blocks: sector size
232 * worst case split in allocation btrees per extent assuming 4 extents:
233 * 4 exts * 2 trees * (2 * max depth - 1) * block size
Dave Chinner7fd36c42013-08-12 20:49:32 +1000234 */
235STATIC uint
236xfs_calc_itruncate_reservation(
237 struct xfs_mount *mp)
238{
239 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000240 MAX((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000241 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1,
242 XFS_FSB_TO_B(mp, 1))),
243 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000244 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 4),
Brian Fostera606ebd2018-01-08 10:41:37 -0800245 XFS_FSB_TO_B(mp, 1))));
Dave Chinner7fd36c42013-08-12 20:49:32 +1000246}
247
248/*
249 * In renaming a files we can modify:
250 * the four inodes involved: 4 * inode size
251 * the two directory btrees: 2 * (max depth + v2) * dir block size
252 * the two directory bmap btrees: 2 * max depth * block size
253 * And the bmap_finish transaction can free dir and bmap blocks (two sets
254 * of bmap blocks) giving:
255 * the agf for the ags in which the blocks live: 3 * sector size
256 * the agfl for the ags in which the blocks live: 3 * sector size
257 * the superblock for the free block count: sector size
258 * the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size
259 */
260STATIC uint
261xfs_calc_rename_reservation(
262 struct xfs_mount *mp)
263{
264 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000265 MAX((xfs_calc_inode_res(mp, 4) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000266 xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp),
267 XFS_FSB_TO_B(mp, 1))),
268 (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000269 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 3),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000270 XFS_FSB_TO_B(mp, 1))));
271}
272
273/*
Zhi Yong Wuab297432013-12-18 08:22:41 +0800274 * For removing an inode from unlinked list at first, we can modify:
275 * the agi hash list and counters: sector size
276 * the on disk inode before ours in the agi hash list: inode cluster size
Brian Fostere8341d92018-01-08 10:41:36 -0800277 * the on disk inode in the agi hash list: inode cluster size
Zhi Yong Wuab297432013-12-18 08:22:41 +0800278 */
279STATIC uint
280xfs_calc_iunlink_remove_reservation(
281 struct xfs_mount *mp)
282{
283 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
Brian Fostere8341d92018-01-08 10:41:36 -0800284 2 * max_t(uint, XFS_FSB_TO_B(mp, 1), mp->m_inode_cluster_size);
Zhi Yong Wuab297432013-12-18 08:22:41 +0800285}
286
287/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000288 * For creating a link to an inode:
289 * the parent directory inode: inode size
290 * the linked inode: inode size
291 * the directory btree could split: (max depth + v2) * dir block size
292 * the directory bmap btree could join or split: (max depth + v2) * blocksize
293 * And the bmap_finish transaction can free some bmap blocks giving:
294 * the agf for the ag in which the blocks live: sector size
295 * the agfl for the ag in which the blocks live: sector size
296 * the superblock for the free block count: sector size
297 * the allocation btrees: 2 trees * (2 * max depth - 1) * block size
298 */
299STATIC uint
300xfs_calc_link_reservation(
301 struct xfs_mount *mp)
302{
303 return XFS_DQUOT_LOGRES(mp) +
Zhi Yong Wuab297432013-12-18 08:22:41 +0800304 xfs_calc_iunlink_remove_reservation(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000305 MAX((xfs_calc_inode_res(mp, 2) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000306 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
307 XFS_FSB_TO_B(mp, 1))),
308 (xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000309 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000310 XFS_FSB_TO_B(mp, 1))));
311}
312
313/*
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800314 * For adding an inode to unlinked list we can modify:
315 * the agi hash list: sector size
Brian Fostere8341d92018-01-08 10:41:36 -0800316 * the on disk inode: inode cluster size
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800317 */
318STATIC uint
319xfs_calc_iunlink_add_reservation(xfs_mount_t *mp)
320{
321 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
Brian Fostere8341d92018-01-08 10:41:36 -0800322 max_t(uint, XFS_FSB_TO_B(mp, 1), mp->m_inode_cluster_size);
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800323}
324
325/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000326 * For removing a directory entry we can modify:
327 * the parent directory inode: inode size
328 * the removed inode: inode size
329 * the directory btree could join: (max depth + v2) * dir block size
330 * the directory bmap btree could join or split: (max depth + v2) * blocksize
331 * And the bmap_finish transaction can free the dir and bmap blocks giving:
332 * the agf for the ag in which the blocks live: 2 * sector size
333 * the agfl for the ag in which the blocks live: 2 * sector size
334 * the superblock for the free block count: sector size
335 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
336 */
337STATIC uint
338xfs_calc_remove_reservation(
339 struct xfs_mount *mp)
340{
341 return XFS_DQUOT_LOGRES(mp) +
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800342 xfs_calc_iunlink_add_reservation(mp) +
343 MAX((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000344 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
345 XFS_FSB_TO_B(mp, 1))),
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800346 (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000347 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 2),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000348 XFS_FSB_TO_B(mp, 1))));
349}
350
351/*
352 * For create, break it in to the two cases that the transaction
353 * covers. We start with the modify case - allocation done by modification
354 * of the state of existing inodes - and the allocation case.
355 */
356
357/*
358 * For create we can modify:
359 * the parent directory inode: inode size
360 * the new inode: inode size
361 * the inode btree entry: block size
362 * the superblock for the nlink flag: sector size
363 * the directory btree: (max depth + v2) * dir block size
364 * the directory inode's bmap btree: (max depth + v2) * block size
Brian Foster9d43b182014-04-24 16:00:52 +1000365 * the finobt (record modification and allocation btrees)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000366 */
367STATIC uint
368xfs_calc_create_resv_modify(
369 struct xfs_mount *mp)
370{
Dave Chinner23956702013-08-28 16:10:35 +1000371 return xfs_calc_inode_res(mp, 2) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000372 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
373 (uint)XFS_FSB_TO_B(mp, 1) +
Brian Foster9d43b182014-04-24 16:00:52 +1000374 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), XFS_FSB_TO_B(mp, 1)) +
Brian Fosterf03c78f2018-01-08 10:41:37 -0800375 xfs_calc_finobt_res(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000376}
377
378/*
379 * For create we can allocate some inodes giving:
380 * the agi and agf of the ag getting the new inodes: 2 * sectorsize
381 * the superblock for the nlink flag: sector size
Jie Liu126cd102013-12-13 15:51:48 +1100382 * the inode blocks allocated: mp->m_ialloc_blks * blocksize
Dave Chinner7fd36c42013-08-12 20:49:32 +1000383 * the allocation btrees: 2 trees * (max depth - 1) * block size
Brian Fosterf03c78f2018-01-08 10:41:37 -0800384 * the inode btree (record insertion)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000385 */
386STATIC uint
387xfs_calc_create_resv_alloc(
388 struct xfs_mount *mp)
389{
390 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
391 mp->m_sb.sb_sectsize +
Jie Liu126cd102013-12-13 15:51:48 +1100392 xfs_calc_buf_res(mp->m_ialloc_blks, XFS_FSB_TO_B(mp, 1)) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000393 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Brian Fosterf03c78f2018-01-08 10:41:37 -0800394 XFS_FSB_TO_B(mp, 1)) +
395 xfs_calc_inobt_res(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000396}
397
398STATIC uint
399__xfs_calc_create_reservation(
400 struct xfs_mount *mp)
401{
402 return XFS_DQUOT_LOGRES(mp) +
403 MAX(xfs_calc_create_resv_alloc(mp),
404 xfs_calc_create_resv_modify(mp));
405}
406
407/*
408 * For icreate we can allocate some inodes giving:
409 * the agi and agf of the ag getting the new inodes: 2 * sectorsize
410 * the superblock for the nlink flag: sector size
Dave Chinner7fd36c42013-08-12 20:49:32 +1000411 * the allocation btrees: 2 trees * (max depth - 1) * block size
Brian Fosterf03c78f2018-01-08 10:41:37 -0800412 * the inobt (record insertion)
Brian Foster9d43b182014-04-24 16:00:52 +1000413 * the finobt (record insertion)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000414 */
415STATIC uint
416xfs_calc_icreate_resv_alloc(
417 struct xfs_mount *mp)
418{
419 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
420 mp->m_sb.sb_sectsize +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000421 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Brian Foster9d43b182014-04-24 16:00:52 +1000422 XFS_FSB_TO_B(mp, 1)) +
Brian Fosterf03c78f2018-01-08 10:41:37 -0800423 xfs_calc_inobt_res(mp) +
424 xfs_calc_finobt_res(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000425}
426
427STATIC uint
428xfs_calc_icreate_reservation(xfs_mount_t *mp)
429{
430 return XFS_DQUOT_LOGRES(mp) +
431 MAX(xfs_calc_icreate_resv_alloc(mp),
432 xfs_calc_create_resv_modify(mp));
433}
434
435STATIC uint
436xfs_calc_create_reservation(
437 struct xfs_mount *mp)
438{
439 if (xfs_sb_version_hascrc(&mp->m_sb))
440 return xfs_calc_icreate_reservation(mp);
441 return __xfs_calc_create_reservation(mp);
442
443}
444
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800445STATIC uint
446xfs_calc_create_tmpfile_reservation(
447 struct xfs_mount *mp)
448{
449 uint res = XFS_DQUOT_LOGRES(mp);
450
451 if (xfs_sb_version_hascrc(&mp->m_sb))
452 res += xfs_calc_icreate_resv_alloc(mp);
453 else
454 res += xfs_calc_create_resv_alloc(mp);
455
456 return res + xfs_calc_iunlink_add_reservation(mp);
457}
458
Dave Chinner7fd36c42013-08-12 20:49:32 +1000459/*
460 * Making a new directory is the same as creating a new file.
461 */
462STATIC uint
463xfs_calc_mkdir_reservation(
464 struct xfs_mount *mp)
465{
466 return xfs_calc_create_reservation(mp);
467}
468
469
470/*
471 * Making a new symplink is the same as creating a new file, but
472 * with the added blocks for remote symlink data which can be up to 1kB in
Darrick J. Wong6eb0b8d2017-07-07 08:37:26 -0700473 * length (XFS_SYMLINK_MAXLEN).
Dave Chinner7fd36c42013-08-12 20:49:32 +1000474 */
475STATIC uint
476xfs_calc_symlink_reservation(
477 struct xfs_mount *mp)
478{
479 return xfs_calc_create_reservation(mp) +
Darrick J. Wong6eb0b8d2017-07-07 08:37:26 -0700480 xfs_calc_buf_res(1, XFS_SYMLINK_MAXLEN);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000481}
482
483/*
484 * In freeing an inode we can modify:
485 * the inode being freed: inode size
Brian Fostera6f48592018-01-08 10:41:36 -0800486 * the super block free inode counter, AGF and AGFL: sector size
487 * the on disk inode (agi unlinked list removal)
488 * the inode chunk is marked stale (headers only)
Brian Fosterf03c78f2018-01-08 10:41:37 -0800489 * the inode btree
Brian Foster9d43b182014-04-24 16:00:52 +1000490 * the finobt (record insertion, removal or modification)
Brian Fosterf03c78f2018-01-08 10:41:37 -0800491 *
492 * Note that the allocfree res. for the inode chunk itself is not included
493 * because the extent free occurs after a transaction roll. We could take the
494 * maximum of the pre/post roll operations, but the pre-roll reservation already
495 * includes at least one allocfree res. for the inobt and is thus guaranteed to
496 * be larger.
Dave Chinner7fd36c42013-08-12 20:49:32 +1000497 */
498STATIC uint
499xfs_calc_ifree_reservation(
500 struct xfs_mount *mp)
501{
502 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000503 xfs_calc_inode_res(mp, 1) +
Brian Fostera6f48592018-01-08 10:41:36 -0800504 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
Zhi Yong Wuab297432013-12-18 08:22:41 +0800505 xfs_calc_iunlink_remove_reservation(mp) +
Brian Fostera6f48592018-01-08 10:41:36 -0800506 xfs_calc_buf_res(mp->m_ialloc_blks, 0) +
Brian Fosterf03c78f2018-01-08 10:41:37 -0800507 xfs_calc_inobt_res(mp) +
508 xfs_calc_finobt_res(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000509}
510
511/*
512 * When only changing the inode we log the inode and possibly the superblock
513 * We also add a bit of slop for the transaction stuff.
514 */
515STATIC uint
516xfs_calc_ichange_reservation(
517 struct xfs_mount *mp)
518{
519 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000520 xfs_calc_inode_res(mp, 1) +
521 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000522
523}
524
525/*
526 * Growing the data section of the filesystem.
527 * superblock
528 * agi and agf
529 * allocation btrees
530 */
531STATIC uint
532xfs_calc_growdata_reservation(
533 struct xfs_mount *mp)
534{
535 return xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000536 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000537 XFS_FSB_TO_B(mp, 1));
538}
539
540/*
541 * Growing the rt section of the filesystem.
542 * In the first set of transactions (ALLOC) we allocate space to the
543 * bitmap or summary files.
544 * superblock: sector size
545 * agf of the ag from which the extent is allocated: sector size
546 * bmap btree for bitmap/summary inode: max depth * blocksize
547 * bitmap/summary inode: inode size
548 * allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize
549 */
550STATIC uint
551xfs_calc_growrtalloc_reservation(
552 struct xfs_mount *mp)
553{
554 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
555 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK),
556 XFS_FSB_TO_B(mp, 1)) +
Dave Chinner23956702013-08-28 16:10:35 +1000557 xfs_calc_inode_res(mp, 1) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000558 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000559 XFS_FSB_TO_B(mp, 1));
560}
561
562/*
563 * Growing the rt section of the filesystem.
564 * In the second set of transactions (ZERO) we zero the new metadata blocks.
565 * one bitmap/summary block: blocksize
566 */
567STATIC uint
568xfs_calc_growrtzero_reservation(
569 struct xfs_mount *mp)
570{
571 return xfs_calc_buf_res(1, mp->m_sb.sb_blocksize);
572}
573
574/*
575 * Growing the rt section of the filesystem.
576 * In the third set of transactions (FREE) we update metadata without
577 * allocating any new blocks.
578 * superblock: sector size
579 * bitmap inode: inode size
580 * summary inode: inode size
581 * one bitmap block: blocksize
582 * summary blocks: new summary size
583 */
584STATIC uint
585xfs_calc_growrtfree_reservation(
586 struct xfs_mount *mp)
587{
588 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
Dave Chinner23956702013-08-28 16:10:35 +1000589 xfs_calc_inode_res(mp, 2) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000590 xfs_calc_buf_res(1, mp->m_sb.sb_blocksize) +
591 xfs_calc_buf_res(1, mp->m_rsumsize);
592}
593
594/*
595 * Logging the inode modification timestamp on a synchronous write.
596 * inode
597 */
598STATIC uint
599xfs_calc_swrite_reservation(
600 struct xfs_mount *mp)
601{
Dave Chinner23956702013-08-28 16:10:35 +1000602 return xfs_calc_inode_res(mp, 1);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000603}
604
605/*
606 * Logging the inode mode bits when writing a setuid/setgid file
607 * inode
608 */
609STATIC uint
Dave Chinner23956702013-08-28 16:10:35 +1000610xfs_calc_writeid_reservation(
611 struct xfs_mount *mp)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000612{
Dave Chinner23956702013-08-28 16:10:35 +1000613 return xfs_calc_inode_res(mp, 1);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000614}
615
616/*
617 * Converting the inode from non-attributed to attributed.
618 * the inode being converted: inode size
619 * agf block and superblock (for block allocation)
620 * the new block (directory sized)
621 * bmap blocks for the new directory block
622 * allocation btrees
623 */
624STATIC uint
625xfs_calc_addafork_reservation(
626 struct xfs_mount *mp)
627{
628 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000629 xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000630 xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
Dave Chinner8f661932014-06-06 15:15:59 +1000631 xfs_calc_buf_res(1, mp->m_dir_geo->blksize) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000632 xfs_calc_buf_res(XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1,
633 XFS_FSB_TO_B(mp, 1)) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000634 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000635 XFS_FSB_TO_B(mp, 1));
636}
637
638/*
639 * Removing the attribute fork of a file
640 * the inode being truncated: inode size
641 * the inode's bmap btree: max depth * block size
642 * And the bmap_finish transaction can free the blocks and bmap blocks:
643 * the agf for each of the ags: 4 * sector size
644 * the agfl for each of the ags: 4 * sector size
645 * the super block to reflect the freed blocks: sector size
646 * worst case split in allocation btrees per extent assuming 4 extents:
647 * 4 exts * 2 trees * (2 * max depth - 1) * block size
648 */
649STATIC uint
650xfs_calc_attrinval_reservation(
651 struct xfs_mount *mp)
652{
Dave Chinner23956702013-08-28 16:10:35 +1000653 return MAX((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000654 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
655 XFS_FSB_TO_B(mp, 1))),
656 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000657 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 4),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000658 XFS_FSB_TO_B(mp, 1))));
659}
660
661/*
662 * Setting an attribute at mount time.
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(see
670 * below).
671 */
672STATIC uint
673xfs_calc_attrsetm_reservation(
674 struct xfs_mount *mp)
675{
676 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000677 xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000678 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
679 xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH, XFS_FSB_TO_B(mp, 1));
680}
681
682/*
683 * Setting an attribute at runtime, transaction space unit per block.
684 * the superblock for allocations: sector size
685 * the inode bmap btree could join or split: max depth * block size
686 * Since the runtime attribute transaction space is dependent on the total
687 * blocks needed for the 1st bmap, here we calculate out the space unit for
688 * one block so that the caller could figure out the total space according
Jie Liu3d3c8b52013-08-12 20:49:59 +1000689 * to the attibute extent length in blocks by:
690 * ext * M_RES(mp)->tr_attrsetrt.tr_logres
Dave Chinner7fd36c42013-08-12 20:49:32 +1000691 */
692STATIC uint
693xfs_calc_attrsetrt_reservation(
694 struct xfs_mount *mp)
695{
696 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
697 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
698 XFS_FSB_TO_B(mp, 1));
699}
700
701/*
702 * Removing an attribute.
703 * the inode: inode size
704 * the attribute btree could join: max depth * block size
705 * the inode bmap btree could join or split: max depth * block size
706 * And the bmap_finish transaction can free the attr blocks freed giving:
707 * the agf for the ag in which the blocks live: 2 * sector size
708 * the agfl for the ag in which the blocks live: 2 * sector size
709 * the superblock for the free block count: sector size
710 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
711 */
712STATIC uint
713xfs_calc_attrrm_reservation(
714 struct xfs_mount *mp)
715{
716 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000717 MAX((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000718 xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH,
719 XFS_FSB_TO_B(mp, 1)) +
720 (uint)XFS_FSB_TO_B(mp,
721 XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) +
722 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), 0)),
723 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000724 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 2),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000725 XFS_FSB_TO_B(mp, 1))));
726}
727
728/*
729 * Clearing a bad agino number in an agi hash bucket.
730 */
731STATIC uint
732xfs_calc_clear_agi_bucket_reservation(
733 struct xfs_mount *mp)
734{
735 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
736}
737
738/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000739 * Adjusting quota limits.
740 * the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot)
741 */
742STATIC uint
743xfs_calc_qm_setqlim_reservation(
744 struct xfs_mount *mp)
745{
746 return xfs_calc_buf_res(1, sizeof(struct xfs_disk_dquot));
747}
748
749/*
750 * Allocating quota on disk if needed.
Brian Foster410b11a2014-02-07 14:55:54 +1100751 * the write transaction log space for quota file extent allocation
Dave Chinner7fd36c42013-08-12 20:49:32 +1000752 * the unit of quota allocation: one system block size
753 */
754STATIC uint
755xfs_calc_qm_dqalloc_reservation(
756 struct xfs_mount *mp)
757{
Brian Foster410b11a2014-02-07 14:55:54 +1100758 return xfs_calc_write_reservation(mp) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000759 xfs_calc_buf_res(1,
760 XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1);
761}
762
763/*
764 * Turning off quotas.
765 * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2
766 * the superblock for the quota flags: sector size
767 */
768STATIC uint
769xfs_calc_qm_quotaoff_reservation(
770 struct xfs_mount *mp)
771{
772 return sizeof(struct xfs_qoff_logitem) * 2 +
773 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
774}
775
776/*
777 * End of turning off quotas.
778 * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2
779 */
780STATIC uint
781xfs_calc_qm_quotaoff_end_reservation(
782 struct xfs_mount *mp)
783{
784 return sizeof(struct xfs_qoff_logitem) * 2;
785}
786
787/*
788 * Syncing the incore super block changes to disk.
789 * the super block to reflect the changes: sector size
790 */
791STATIC uint
792xfs_calc_sb_reservation(
793 struct xfs_mount *mp)
794{
795 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
796}
797
798void
799xfs_trans_resv_calc(
800 struct xfs_mount *mp,
801 struct xfs_trans_resv *resp)
802{
Jie Liu0eadd102013-08-12 20:49:56 +1000803 /*
804 * The following transactions are logged in physical format and
805 * require a permanent reservation on space.
806 */
807 resp->tr_write.tr_logres = xfs_calc_write_reservation(mp);
Darrick J. Wong80de4622016-10-03 09:11:47 -0700808 if (xfs_sb_version_hasreflink(&mp->m_sb))
809 resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT_REFLINK;
810 else
811 resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT;
Jie Liu0eadd102013-08-12 20:49:56 +1000812 resp->tr_write.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
813
814 resp->tr_itruncate.tr_logres = xfs_calc_itruncate_reservation(mp);
Darrick J. Wong80de4622016-10-03 09:11:47 -0700815 if (xfs_sb_version_hasreflink(&mp->m_sb))
816 resp->tr_itruncate.tr_logcount =
817 XFS_ITRUNCATE_LOG_COUNT_REFLINK;
818 else
819 resp->tr_itruncate.tr_logcount = XFS_ITRUNCATE_LOG_COUNT;
Jie Liu0eadd102013-08-12 20:49:56 +1000820 resp->tr_itruncate.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
821
822 resp->tr_rename.tr_logres = xfs_calc_rename_reservation(mp);
823 resp->tr_rename.tr_logcount = XFS_RENAME_LOG_COUNT;
824 resp->tr_rename.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
825
826 resp->tr_link.tr_logres = xfs_calc_link_reservation(mp);
827 resp->tr_link.tr_logcount = XFS_LINK_LOG_COUNT;
828 resp->tr_link.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
829
830 resp->tr_remove.tr_logres = xfs_calc_remove_reservation(mp);
831 resp->tr_remove.tr_logcount = XFS_REMOVE_LOG_COUNT;
832 resp->tr_remove.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
833
834 resp->tr_symlink.tr_logres = xfs_calc_symlink_reservation(mp);
835 resp->tr_symlink.tr_logcount = XFS_SYMLINK_LOG_COUNT;
836 resp->tr_symlink.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
837
838 resp->tr_create.tr_logres = xfs_calc_create_reservation(mp);
839 resp->tr_create.tr_logcount = XFS_CREATE_LOG_COUNT;
840 resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
841
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800842 resp->tr_create_tmpfile.tr_logres =
843 xfs_calc_create_tmpfile_reservation(mp);
844 resp->tr_create_tmpfile.tr_logcount = XFS_CREATE_TMPFILE_LOG_COUNT;
845 resp->tr_create_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
846
Jie Liu0eadd102013-08-12 20:49:56 +1000847 resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp);
848 resp->tr_mkdir.tr_logcount = XFS_MKDIR_LOG_COUNT;
849 resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
850
851 resp->tr_ifree.tr_logres = xfs_calc_ifree_reservation(mp);
852 resp->tr_ifree.tr_logcount = XFS_INACTIVE_LOG_COUNT;
853 resp->tr_ifree.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
854
855 resp->tr_addafork.tr_logres = xfs_calc_addafork_reservation(mp);
856 resp->tr_addafork.tr_logcount = XFS_ADDAFORK_LOG_COUNT;
857 resp->tr_addafork.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
858
859 resp->tr_attrinval.tr_logres = xfs_calc_attrinval_reservation(mp);
860 resp->tr_attrinval.tr_logcount = XFS_ATTRINVAL_LOG_COUNT;
861 resp->tr_attrinval.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
862
863 resp->tr_attrsetm.tr_logres = xfs_calc_attrsetm_reservation(mp);
864 resp->tr_attrsetm.tr_logcount = XFS_ATTRSET_LOG_COUNT;
865 resp->tr_attrsetm.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
866
867 resp->tr_attrrm.tr_logres = xfs_calc_attrrm_reservation(mp);
868 resp->tr_attrrm.tr_logcount = XFS_ATTRRM_LOG_COUNT;
869 resp->tr_attrrm.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
870
871 resp->tr_growrtalloc.tr_logres = xfs_calc_growrtalloc_reservation(mp);
872 resp->tr_growrtalloc.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT;
873 resp->tr_growrtalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
874
875 resp->tr_qm_dqalloc.tr_logres = xfs_calc_qm_dqalloc_reservation(mp);
Darrick J. Wong80de4622016-10-03 09:11:47 -0700876 if (xfs_sb_version_hasreflink(&mp->m_sb))
877 resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT_REFLINK;
878 else
879 resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT;
Jie Liu0eadd102013-08-12 20:49:56 +1000880 resp->tr_qm_dqalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
881
882 /*
883 * The following transactions are logged in logical format with
884 * a default log count.
885 */
Jie Liu0eadd102013-08-12 20:49:56 +1000886 resp->tr_qm_setqlim.tr_logres = xfs_calc_qm_setqlim_reservation(mp);
887 resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT;
888
889 resp->tr_qm_quotaoff.tr_logres = xfs_calc_qm_quotaoff_reservation(mp);
890 resp->tr_qm_quotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT;
891
892 resp->tr_qm_equotaoff.tr_logres =
893 xfs_calc_qm_quotaoff_end_reservation(mp);
894 resp->tr_qm_equotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT;
895
896 resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp);
897 resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT;
898
899 /* The following transaction are logged in logical format */
900 resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp);
901 resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp);
Jie Liu20996c92013-08-12 20:49:57 +1000902 resp->tr_fsyncts.tr_logres = xfs_calc_swrite_reservation(mp);
Jie Liu0eadd102013-08-12 20:49:56 +1000903 resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp);
904 resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp);
905 resp->tr_clearagi.tr_logres = xfs_calc_clear_agi_bucket_reservation(mp);
906 resp->tr_growrtzero.tr_logres = xfs_calc_growrtzero_reservation(mp);
907 resp->tr_growrtfree.tr_logres = xfs_calc_growrtfree_reservation(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000908}