blob: f99a7aefe4184dc86aa9bb8ee7e631526b57d711 [file] [log] [blame]
Dave Chinner0b61f8a2018-06-05 19:42:14 -07001// SPDX-License-Identifier: GPL-2.0
Dave Chinner7fd36c42013-08-12 20:49:32 +10002/*
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
4 * Copyright (C) 2010 Red Hat, Inc.
5 * All Rights Reserved.
Dave Chinner7fd36c42013-08-12 20:49:32 +10006 */
7#include "xfs.h"
8#include "xfs_fs.h"
Dave Chinner70a98832013-10-23 10:36:05 +11009#include "xfs_shared.h"
Dave Chinner239880e2013-10-23 10:50:10 +110010#include "xfs_format.h"
11#include "xfs_log_format.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100012#include "xfs_trans_resv.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100013#include "xfs_mount.h"
Dave Chinner57062782013-10-15 09:17:51 +110014#include "xfs_da_format.h"
Dave Chinnerd6cf1302014-06-06 15:14:11 +100015#include "xfs_da_btree.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100016#include "xfs_inode.h"
Dave Chinnera4fbe6a2013-10-23 10:51:50 +110017#include "xfs_bmap_btree.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100018#include "xfs_ialloc.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100019#include "xfs_quota.h"
Dave Chinner239880e2013-10-23 10:50:10 +110020#include "xfs_trans.h"
Dave Chinner7fd36c42013-08-12 20:49:32 +100021#include "xfs_qm.h"
22#include "xfs_trans_space.h"
23#include "xfs_trace.h"
24
Brian Foster57af33e2018-01-08 10:41:38 -080025#define _ALLOC true
26#define _FREE false
27
Dave Chinner7fd36c42013-08-12 20:49:32 +100028/*
29 * A buffer has a format structure overhead in the log in addition
30 * to the data, so we need to take this into account when reserving
31 * space in a transaction for a buffer. Round the space required up
32 * to a multiple of 128 bytes so that we don't change the historical
33 * reservation that has been used for this overhead.
34 */
35STATIC uint
36xfs_buf_log_overhead(void)
37{
38 return round_up(sizeof(struct xlog_op_header) +
39 sizeof(struct xfs_buf_log_format), 128);
40}
41
42/*
43 * Calculate out transaction log reservation per item in bytes.
44 *
45 * The nbufs argument is used to indicate the number of items that
46 * will be changed in a transaction. size is used to tell how many
47 * bytes should be reserved per item.
48 */
49STATIC uint
50xfs_calc_buf_res(
51 uint nbufs,
52 uint size)
53{
54 return nbufs * (size + xfs_buf_log_overhead());
55}
56
57/*
Darrick J. Wongfa30f032016-08-03 11:37:10 +100058 * Per-extent log reservation for the btree changes involved in freeing or
59 * allocating an extent. In classic XFS there were two trees that will be
60 * modified (bnobt + cntbt). With rmap enabled, there are three trees
Darrick J. Wongf310bd22016-10-03 09:11:19 -070061 * (rmapbt). With reflink, there are four trees (refcountbt). The number of
62 * blocks reserved is based on the formula:
Darrick J. Wongfa30f032016-08-03 11:37:10 +100063 *
64 * num trees * ((2 blocks/level * max depth) - 1)
65 *
66 * Keep in mind that max depth is calculated separately for each type of tree.
67 */
Darrick J. Wong1946b912016-10-03 09:11:18 -070068uint
Darrick J. Wongfa30f032016-08-03 11:37:10 +100069xfs_allocfree_log_count(
70 struct xfs_mount *mp,
71 uint num_ops)
72{
73 uint blocks;
74
75 blocks = num_ops * 2 * (2 * mp->m_ag_maxlevels - 1);
76 if (xfs_sb_version_hasrmapbt(&mp->m_sb))
77 blocks += num_ops * (2 * mp->m_rmap_maxlevels - 1);
Darrick J. Wongf310bd22016-10-03 09:11:19 -070078 if (xfs_sb_version_hasreflink(&mp->m_sb))
79 blocks += num_ops * (2 * mp->m_refc_maxlevels - 1);
Darrick J. Wongfa30f032016-08-03 11:37:10 +100080
81 return blocks;
82}
83
84/*
Dave Chinner23956702013-08-28 16:10:35 +100085 * Logging inodes is really tricksy. They are logged in memory format,
86 * which means that what we write into the log doesn't directly translate into
87 * the amount of space they use on disk.
88 *
89 * Case in point - btree format forks in memory format use more space than the
90 * on-disk format. In memory, the buffer contains a normal btree block header so
91 * the btree code can treat it as though it is just another generic buffer.
92 * However, when we write it to the inode fork, we don't write all of this
93 * header as it isn't needed. e.g. the root is only ever in the inode, so
94 * there's no need for sibling pointers which would waste 16 bytes of space.
95 *
96 * Hence when we have an inode with a maximally sized btree format fork, then
97 * amount of information we actually log is greater than the size of the inode
98 * on disk. Hence we need an inode reservation function that calculates all this
99 * correctly. So, we log:
100 *
Dave Chinnerfe4c2242014-03-07 16:19:14 +1100101 * - 4 log op headers for object
102 * - for the ilf, the inode core and 2 forks
Dave Chinner23956702013-08-28 16:10:35 +1000103 * - inode log format object
Dave Chinnerfe4c2242014-03-07 16:19:14 +1100104 * - the inode core
105 * - two inode forks containing bmap btree root blocks.
106 * - the btree data contained by both forks will fit into the inode size,
107 * hence when combined with the inode core above, we have a total of the
108 * actual inode size.
109 * - the BMBT headers need to be accounted separately, as they are
110 * additional to the records and pointers that fit inside the inode
111 * forks.
Dave Chinner23956702013-08-28 16:10:35 +1000112 */
113STATIC uint
114xfs_calc_inode_res(
115 struct xfs_mount *mp,
116 uint ninodes)
117{
Dave Chinnerfe4c2242014-03-07 16:19:14 +1100118 return ninodes *
119 (4 * sizeof(struct xlog_op_header) +
120 sizeof(struct xfs_inode_log_format) +
121 mp->m_sb.sb_inodesize +
122 2 * XFS_BMBT_BLOCK_LEN(mp));
Dave Chinner23956702013-08-28 16:10:35 +1000123}
124
125/*
Brian Fosterf03c78f2018-01-08 10:41:37 -0800126 * Inode btree record insertion/removal modifies the inode btree and free space
127 * btrees (since the inobt does not use the agfl). This requires the following
128 * reservation:
Brian Foster9d43b182014-04-24 16:00:52 +1000129 *
Brian Fosterf03c78f2018-01-08 10:41:37 -0800130 * the inode btree: max depth * blocksize
Brian Foster9d43b182014-04-24 16:00:52 +1000131 * the allocation btrees: 2 trees * (max depth - 1) * block size
Brian Fosterf03c78f2018-01-08 10:41:37 -0800132 *
133 * The caller must account for SB and AG header modifications, etc.
134 */
135STATIC uint
136xfs_calc_inobt_res(
137 struct xfs_mount *mp)
138{
139 return xfs_calc_buf_res(mp->m_in_maxlevels, XFS_FSB_TO_B(mp, 1)) +
140 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
141 XFS_FSB_TO_B(mp, 1));
142}
143
144/*
145 * The free inode btree is a conditional feature. The behavior differs slightly
146 * from that of the traditional inode btree in that the finobt tracks records
147 * for inode chunks with at least one free inode. A record can be removed from
148 * the tree during individual inode allocation. Therefore the finobt
149 * reservation is unconditional for both the inode chunk allocation and
150 * individual inode allocation (modify) cases.
151 *
152 * Behavior aside, the reservation for finobt modification is equivalent to the
153 * traditional inobt: cover a full finobt shape change plus block allocation.
Brian Foster9d43b182014-04-24 16:00:52 +1000154 */
155STATIC uint
156xfs_calc_finobt_res(
Brian Fosterf03c78f2018-01-08 10:41:37 -0800157 struct xfs_mount *mp)
Brian Foster9d43b182014-04-24 16:00:52 +1000158{
Brian Foster9d43b182014-04-24 16:00:52 +1000159 if (!xfs_sb_version_hasfinobt(&mp->m_sb))
160 return 0;
161
Brian Fosterf03c78f2018-01-08 10:41:37 -0800162 return xfs_calc_inobt_res(mp);
Brian Foster9d43b182014-04-24 16:00:52 +1000163}
164
165/*
Brian Foster57af33e2018-01-08 10:41:38 -0800166 * Calculate the reservation required to allocate or free an inode chunk. This
167 * includes:
168 *
169 * the allocation btrees: 2 trees * (max depth - 1) * block size
170 * the inode chunk: m_ialloc_blks * N
171 *
172 * The size N of the inode chunk reservation depends on whether it is for
173 * allocation or free and which type of create transaction is in use. An inode
174 * chunk free always invalidates the buffers and only requires reservation for
175 * headers (N == 0). An inode chunk allocation requires a chunk sized
176 * reservation on v4 and older superblocks to initialize the chunk. No chunk
177 * reservation is required for allocation on v5 supers, which use ordered
178 * buffers to initialize.
179 */
180STATIC uint
181xfs_calc_inode_chunk_res(
182 struct xfs_mount *mp,
183 bool alloc)
184{
185 uint res, size = 0;
186
187 res = xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
188 XFS_FSB_TO_B(mp, 1));
189 if (alloc) {
190 /* icreate tx uses ordered buffers */
191 if (xfs_sb_version_hascrc(&mp->m_sb))
192 return res;
193 size = XFS_FSB_TO_B(mp, 1);
194 }
195
196 res += xfs_calc_buf_res(mp->m_ialloc_blks, size);
197 return res;
198}
199
200/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000201 * Various log reservation values.
202 *
203 * These are based on the size of the file system block because that is what
204 * most transactions manipulate. Each adds in an additional 128 bytes per
205 * item logged to try to account for the overhead of the transaction mechanism.
206 *
207 * Note: Most of the reservations underestimate the number of allocation
Darrick J. Wong310a75a2016-08-03 11:18:10 +1000208 * groups into which they could free extents in the xfs_defer_finish() call.
Dave Chinner7fd36c42013-08-12 20:49:32 +1000209 * This is because the number in the worst case is quite high and quite
Darrick J. Wong310a75a2016-08-03 11:18:10 +1000210 * unusual. In order to fix this we need to change xfs_defer_finish() to free
Dave Chinner7fd36c42013-08-12 20:49:32 +1000211 * extents in only a single AG at a time. This will require changes to the
212 * EFI code as well, however, so that the EFI for the extents not freed is
213 * logged again in each transaction. See SGI PV #261917.
214 *
215 * Reservation functions here avoid a huge stack in xfs_trans_init due to
216 * register overflow from temporaries in the calculations.
217 */
218
219
220/*
221 * In a write transaction we can allocate a maximum of 2
222 * extents. This gives:
223 * the inode getting the new extents: inode size
224 * the inode's bmap btree: max depth * block size
225 * the agfs of the ags from which the extents are allocated: 2 * sector
226 * the superblock free block counter: sector size
227 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
228 * And the bmap_finish transaction can free bmap blocks in a join:
229 * the agfs of the ags containing the blocks: 2 * sector size
230 * the agfls of the ags containing the blocks: 2 * sector size
231 * the super block free block counter: sector size
232 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
233 */
234STATIC uint
235xfs_calc_write_reservation(
236 struct xfs_mount *mp)
237{
238 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner9bb54cb2018-06-07 07:54:02 -0700239 max((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000240 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK),
241 XFS_FSB_TO_B(mp, 1)) +
242 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000243 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 2),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000244 XFS_FSB_TO_B(mp, 1))),
245 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000246 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 2),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000247 XFS_FSB_TO_B(mp, 1))));
248}
249
250/*
251 * In truncating a file we free up to two extents at once. We can modify:
252 * the inode being truncated: inode size
253 * the inode's bmap btree: (max depth + 1) * block size
254 * And the bmap_finish transaction can free the blocks and bmap blocks:
255 * the agf for each of the ags: 4 * sector size
256 * the agfl for each of the ags: 4 * sector size
257 * the super block to reflect the freed blocks: sector size
258 * worst case split in allocation btrees per extent assuming 4 extents:
259 * 4 exts * 2 trees * (2 * max depth - 1) * block size
Dave Chinner7fd36c42013-08-12 20:49:32 +1000260 */
261STATIC uint
262xfs_calc_itruncate_reservation(
263 struct xfs_mount *mp)
264{
265 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner9bb54cb2018-06-07 07:54:02 -0700266 max((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000267 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1,
268 XFS_FSB_TO_B(mp, 1))),
269 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000270 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 4),
Brian Fostera606ebd2018-01-08 10:41:37 -0800271 XFS_FSB_TO_B(mp, 1))));
Dave Chinner7fd36c42013-08-12 20:49:32 +1000272}
273
274/*
275 * In renaming a files we can modify:
276 * the four inodes involved: 4 * inode size
277 * the two directory btrees: 2 * (max depth + v2) * dir block size
278 * the two directory bmap btrees: 2 * max depth * block size
279 * And the bmap_finish transaction can free dir and bmap blocks (two sets
280 * of bmap blocks) giving:
281 * the agf for the ags in which the blocks live: 3 * sector size
282 * the agfl for the ags in which the blocks live: 3 * sector size
283 * the superblock for the free block count: sector size
284 * the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size
285 */
286STATIC uint
287xfs_calc_rename_reservation(
288 struct xfs_mount *mp)
289{
290 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner9bb54cb2018-06-07 07:54:02 -0700291 max((xfs_calc_inode_res(mp, 4) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000292 xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp),
293 XFS_FSB_TO_B(mp, 1))),
294 (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000295 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 3),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000296 XFS_FSB_TO_B(mp, 1))));
297}
298
299/*
Zhi Yong Wuab297432013-12-18 08:22:41 +0800300 * For removing an inode from unlinked list at first, we can modify:
301 * the agi hash list and counters: sector size
302 * the on disk inode before ours in the agi hash list: inode cluster size
Brian Fostere8341d92018-01-08 10:41:36 -0800303 * the on disk inode in the agi hash list: inode cluster size
Zhi Yong Wuab297432013-12-18 08:22:41 +0800304 */
305STATIC uint
306xfs_calc_iunlink_remove_reservation(
307 struct xfs_mount *mp)
308{
309 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
Brian Fostere8341d92018-01-08 10:41:36 -0800310 2 * max_t(uint, XFS_FSB_TO_B(mp, 1), mp->m_inode_cluster_size);
Zhi Yong Wuab297432013-12-18 08:22:41 +0800311}
312
313/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000314 * For creating a link to an inode:
315 * the parent directory inode: inode size
316 * the linked inode: inode size
317 * the directory btree could split: (max depth + v2) * dir block size
318 * the directory bmap btree could join or split: (max depth + v2) * blocksize
319 * And the bmap_finish transaction can free some bmap blocks giving:
320 * the agf for the ag in which the blocks live: sector size
321 * the agfl for the ag in which the blocks live: sector size
322 * the superblock for the free block count: sector size
323 * the allocation btrees: 2 trees * (2 * max depth - 1) * block size
324 */
325STATIC uint
326xfs_calc_link_reservation(
327 struct xfs_mount *mp)
328{
329 return XFS_DQUOT_LOGRES(mp) +
Zhi Yong Wuab297432013-12-18 08:22:41 +0800330 xfs_calc_iunlink_remove_reservation(mp) +
Dave Chinner9bb54cb2018-06-07 07:54:02 -0700331 max((xfs_calc_inode_res(mp, 2) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000332 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
333 XFS_FSB_TO_B(mp, 1))),
334 (xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000335 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000336 XFS_FSB_TO_B(mp, 1))));
337}
338
339/*
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800340 * For adding an inode to unlinked list we can modify:
341 * the agi hash list: sector size
Brian Fostere8341d92018-01-08 10:41:36 -0800342 * the on disk inode: inode cluster size
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800343 */
344STATIC uint
345xfs_calc_iunlink_add_reservation(xfs_mount_t *mp)
346{
347 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
Brian Fostere8341d92018-01-08 10:41:36 -0800348 max_t(uint, XFS_FSB_TO_B(mp, 1), mp->m_inode_cluster_size);
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800349}
350
351/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000352 * For removing a directory entry we can modify:
353 * the parent directory inode: inode size
354 * the removed inode: inode size
355 * the directory btree could join: (max depth + v2) * dir block size
356 * the directory bmap btree could join or split: (max depth + v2) * blocksize
357 * And the bmap_finish transaction can free the dir and bmap blocks giving:
358 * the agf for the ag in which the blocks live: 2 * sector size
359 * the agfl for the ag in which the blocks live: 2 * sector size
360 * the superblock for the free block count: sector size
361 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
362 */
363STATIC uint
364xfs_calc_remove_reservation(
365 struct xfs_mount *mp)
366{
367 return XFS_DQUOT_LOGRES(mp) +
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800368 xfs_calc_iunlink_add_reservation(mp) +
Dave Chinner9bb54cb2018-06-07 07:54:02 -0700369 max((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000370 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
371 XFS_FSB_TO_B(mp, 1))),
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800372 (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000373 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 2),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000374 XFS_FSB_TO_B(mp, 1))));
375}
376
377/*
378 * For create, break it in to the two cases that the transaction
379 * covers. We start with the modify case - allocation done by modification
380 * of the state of existing inodes - and the allocation case.
381 */
382
383/*
384 * For create we can modify:
385 * the parent directory inode: inode size
386 * the new inode: inode size
387 * the inode btree entry: block size
388 * the superblock for the nlink flag: sector size
389 * the directory btree: (max depth + v2) * dir block size
390 * the directory inode's bmap btree: (max depth + v2) * block size
Brian Foster9d43b182014-04-24 16:00:52 +1000391 * the finobt (record modification and allocation btrees)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000392 */
393STATIC uint
394xfs_calc_create_resv_modify(
395 struct xfs_mount *mp)
396{
Dave Chinner23956702013-08-28 16:10:35 +1000397 return xfs_calc_inode_res(mp, 2) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000398 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
399 (uint)XFS_FSB_TO_B(mp, 1) +
Brian Foster9d43b182014-04-24 16:00:52 +1000400 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), XFS_FSB_TO_B(mp, 1)) +
Brian Fosterf03c78f2018-01-08 10:41:37 -0800401 xfs_calc_finobt_res(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000402}
403
404/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000405 * For icreate we can allocate some inodes giving:
406 * the agi and agf of the ag getting the new inodes: 2 * sectorsize
407 * the superblock for the nlink flag: sector size
Brian Fosterc017cb52018-01-08 10:41:38 -0800408 * the inode chunk (allocation, optional init)
Brian Fosterf03c78f2018-01-08 10:41:37 -0800409 * the inobt (record insertion)
Brian Fosterc017cb52018-01-08 10:41:38 -0800410 * the finobt (optional, record insertion)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000411 */
412STATIC uint
413xfs_calc_icreate_resv_alloc(
414 struct xfs_mount *mp)
415{
416 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
417 mp->m_sb.sb_sectsize +
Brian Foster57af33e2018-01-08 10:41:38 -0800418 xfs_calc_inode_chunk_res(mp, _ALLOC) +
Brian Fosterf03c78f2018-01-08 10:41:37 -0800419 xfs_calc_inobt_res(mp) +
420 xfs_calc_finobt_res(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000421}
422
423STATIC uint
424xfs_calc_icreate_reservation(xfs_mount_t *mp)
425{
426 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner9bb54cb2018-06-07 07:54:02 -0700427 max(xfs_calc_icreate_resv_alloc(mp),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000428 xfs_calc_create_resv_modify(mp));
429}
430
431STATIC uint
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800432xfs_calc_create_tmpfile_reservation(
433 struct xfs_mount *mp)
434{
435 uint res = XFS_DQUOT_LOGRES(mp);
436
Brian Fosterc017cb52018-01-08 10:41:38 -0800437 res += xfs_calc_icreate_resv_alloc(mp);
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800438 return res + xfs_calc_iunlink_add_reservation(mp);
439}
440
Dave Chinner7fd36c42013-08-12 20:49:32 +1000441/*
442 * Making a new directory is the same as creating a new file.
443 */
444STATIC uint
445xfs_calc_mkdir_reservation(
446 struct xfs_mount *mp)
447{
Brian Fosterc017cb52018-01-08 10:41:38 -0800448 return xfs_calc_icreate_reservation(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000449}
450
451
452/*
453 * Making a new symplink is the same as creating a new file, but
454 * with the added blocks for remote symlink data which can be up to 1kB in
Darrick J. Wong6eb0b8d2017-07-07 08:37:26 -0700455 * length (XFS_SYMLINK_MAXLEN).
Dave Chinner7fd36c42013-08-12 20:49:32 +1000456 */
457STATIC uint
458xfs_calc_symlink_reservation(
459 struct xfs_mount *mp)
460{
Brian Fosterc017cb52018-01-08 10:41:38 -0800461 return xfs_calc_icreate_reservation(mp) +
Darrick J. Wong6eb0b8d2017-07-07 08:37:26 -0700462 xfs_calc_buf_res(1, XFS_SYMLINK_MAXLEN);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000463}
464
465/*
466 * In freeing an inode we can modify:
467 * the inode being freed: inode size
Brian Fostera6f48592018-01-08 10:41:36 -0800468 * the super block free inode counter, AGF and AGFL: sector size
469 * the on disk inode (agi unlinked list removal)
Brian Foster57af33e2018-01-08 10:41:38 -0800470 * the inode chunk (invalidated, headers only)
Brian Fosterf03c78f2018-01-08 10:41:37 -0800471 * the inode btree
Brian Foster9d43b182014-04-24 16:00:52 +1000472 * the finobt (record insertion, removal or modification)
Brian Fosterf03c78f2018-01-08 10:41:37 -0800473 *
Brian Foster57af33e2018-01-08 10:41:38 -0800474 * Note that the inode chunk res. includes an allocfree res. for freeing of the
475 * inode chunk. This is technically extraneous because the inode chunk free is
476 * deferred (it occurs after a transaction roll). Include the extra reservation
477 * anyways since we've had reports of ifree transaction overruns due to too many
478 * agfl fixups during inode chunk frees.
Dave Chinner7fd36c42013-08-12 20:49:32 +1000479 */
480STATIC uint
481xfs_calc_ifree_reservation(
482 struct xfs_mount *mp)
483{
484 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000485 xfs_calc_inode_res(mp, 1) +
Brian Fostera6f48592018-01-08 10:41:36 -0800486 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
Zhi Yong Wuab297432013-12-18 08:22:41 +0800487 xfs_calc_iunlink_remove_reservation(mp) +
Brian Foster57af33e2018-01-08 10:41:38 -0800488 xfs_calc_inode_chunk_res(mp, _FREE) +
Brian Fosterf03c78f2018-01-08 10:41:37 -0800489 xfs_calc_inobt_res(mp) +
490 xfs_calc_finobt_res(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000491}
492
493/*
494 * When only changing the inode we log the inode and possibly the superblock
495 * We also add a bit of slop for the transaction stuff.
496 */
497STATIC uint
498xfs_calc_ichange_reservation(
499 struct xfs_mount *mp)
500{
501 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000502 xfs_calc_inode_res(mp, 1) +
503 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000504
505}
506
507/*
508 * Growing the data section of the filesystem.
509 * superblock
510 * agi and agf
511 * allocation btrees
512 */
513STATIC uint
514xfs_calc_growdata_reservation(
515 struct xfs_mount *mp)
516{
517 return xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000518 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000519 XFS_FSB_TO_B(mp, 1));
520}
521
522/*
523 * Growing the rt section of the filesystem.
524 * In the first set of transactions (ALLOC) we allocate space to the
525 * bitmap or summary files.
526 * superblock: sector size
527 * agf of the ag from which the extent is allocated: sector size
528 * bmap btree for bitmap/summary inode: max depth * blocksize
529 * bitmap/summary inode: inode size
530 * allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize
531 */
532STATIC uint
533xfs_calc_growrtalloc_reservation(
534 struct xfs_mount *mp)
535{
536 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
537 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK),
538 XFS_FSB_TO_B(mp, 1)) +
Dave Chinner23956702013-08-28 16:10:35 +1000539 xfs_calc_inode_res(mp, 1) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000540 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000541 XFS_FSB_TO_B(mp, 1));
542}
543
544/*
545 * Growing the rt section of the filesystem.
546 * In the second set of transactions (ZERO) we zero the new metadata blocks.
547 * one bitmap/summary block: blocksize
548 */
549STATIC uint
550xfs_calc_growrtzero_reservation(
551 struct xfs_mount *mp)
552{
553 return xfs_calc_buf_res(1, mp->m_sb.sb_blocksize);
554}
555
556/*
557 * Growing the rt section of the filesystem.
558 * In the third set of transactions (FREE) we update metadata without
559 * allocating any new blocks.
560 * superblock: sector size
561 * bitmap inode: inode size
562 * summary inode: inode size
563 * one bitmap block: blocksize
564 * summary blocks: new summary size
565 */
566STATIC uint
567xfs_calc_growrtfree_reservation(
568 struct xfs_mount *mp)
569{
570 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
Dave Chinner23956702013-08-28 16:10:35 +1000571 xfs_calc_inode_res(mp, 2) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000572 xfs_calc_buf_res(1, mp->m_sb.sb_blocksize) +
573 xfs_calc_buf_res(1, mp->m_rsumsize);
574}
575
576/*
577 * Logging the inode modification timestamp on a synchronous write.
578 * inode
579 */
580STATIC uint
581xfs_calc_swrite_reservation(
582 struct xfs_mount *mp)
583{
Dave Chinner23956702013-08-28 16:10:35 +1000584 return xfs_calc_inode_res(mp, 1);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000585}
586
587/*
588 * Logging the inode mode bits when writing a setuid/setgid file
589 * inode
590 */
591STATIC uint
Dave Chinner23956702013-08-28 16:10:35 +1000592xfs_calc_writeid_reservation(
593 struct xfs_mount *mp)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000594{
Dave Chinner23956702013-08-28 16:10:35 +1000595 return xfs_calc_inode_res(mp, 1);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000596}
597
598/*
599 * Converting the inode from non-attributed to attributed.
600 * the inode being converted: inode size
601 * agf block and superblock (for block allocation)
602 * the new block (directory sized)
603 * bmap blocks for the new directory block
604 * allocation btrees
605 */
606STATIC uint
607xfs_calc_addafork_reservation(
608 struct xfs_mount *mp)
609{
610 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000611 xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000612 xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
Dave Chinner8f661932014-06-06 15:15:59 +1000613 xfs_calc_buf_res(1, mp->m_dir_geo->blksize) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000614 xfs_calc_buf_res(XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1,
615 XFS_FSB_TO_B(mp, 1)) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000616 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000617 XFS_FSB_TO_B(mp, 1));
618}
619
620/*
621 * Removing the attribute fork of a file
622 * the inode being truncated: inode size
623 * the inode's bmap btree: max depth * block size
624 * And the bmap_finish transaction can free the blocks and bmap blocks:
625 * the agf for each of the ags: 4 * sector size
626 * the agfl for each of the ags: 4 * sector size
627 * the super block to reflect the freed blocks: sector size
628 * worst case split in allocation btrees per extent assuming 4 extents:
629 * 4 exts * 2 trees * (2 * max depth - 1) * block size
630 */
631STATIC uint
632xfs_calc_attrinval_reservation(
633 struct xfs_mount *mp)
634{
Dave Chinner9bb54cb2018-06-07 07:54:02 -0700635 return max((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000636 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
637 XFS_FSB_TO_B(mp, 1))),
638 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000639 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 4),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000640 XFS_FSB_TO_B(mp, 1))));
641}
642
643/*
644 * Setting an attribute at mount time.
645 * the inode getting the attribute
646 * the superblock for allocations
647 * the agfs extents are allocated from
648 * the attribute btree * max depth
649 * the inode allocation btree
650 * Since attribute transaction space is dependent on the size of the attribute,
651 * the calculation is done partially at mount time and partially at runtime(see
652 * below).
653 */
654STATIC uint
655xfs_calc_attrsetm_reservation(
656 struct xfs_mount *mp)
657{
658 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner23956702013-08-28 16:10:35 +1000659 xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000660 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
661 xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH, XFS_FSB_TO_B(mp, 1));
662}
663
664/*
665 * Setting an attribute at runtime, transaction space unit per block.
666 * the superblock for allocations: sector size
667 * the inode bmap btree could join or split: max depth * block size
668 * Since the runtime attribute transaction space is dependent on the total
669 * blocks needed for the 1st bmap, here we calculate out the space unit for
670 * one block so that the caller could figure out the total space according
Jie Liu3d3c8b52013-08-12 20:49:59 +1000671 * to the attibute extent length in blocks by:
672 * ext * M_RES(mp)->tr_attrsetrt.tr_logres
Dave Chinner7fd36c42013-08-12 20:49:32 +1000673 */
674STATIC uint
675xfs_calc_attrsetrt_reservation(
676 struct xfs_mount *mp)
677{
678 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
679 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
680 XFS_FSB_TO_B(mp, 1));
681}
682
683/*
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
693 */
694STATIC uint
695xfs_calc_attrrm_reservation(
696 struct xfs_mount *mp)
697{
698 return XFS_DQUOT_LOGRES(mp) +
Dave Chinner9bb54cb2018-06-07 07:54:02 -0700699 max((xfs_calc_inode_res(mp, 1) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000700 xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH,
701 XFS_FSB_TO_B(mp, 1)) +
702 (uint)XFS_FSB_TO_B(mp,
703 XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) +
704 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), 0)),
705 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
Darrick J. Wongfa30f032016-08-03 11:37:10 +1000706 xfs_calc_buf_res(xfs_allocfree_log_count(mp, 2),
Dave Chinner7fd36c42013-08-12 20:49:32 +1000707 XFS_FSB_TO_B(mp, 1))));
708}
709
710/*
711 * Clearing a bad agino number in an agi hash bucket.
712 */
713STATIC uint
714xfs_calc_clear_agi_bucket_reservation(
715 struct xfs_mount *mp)
716{
717 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
718}
719
720/*
Dave Chinner7fd36c42013-08-12 20:49:32 +1000721 * Adjusting quota limits.
722 * the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot)
723 */
724STATIC uint
Eric Sandeena1f69412018-04-06 10:09:42 -0700725xfs_calc_qm_setqlim_reservation(void)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000726{
727 return xfs_calc_buf_res(1, sizeof(struct xfs_disk_dquot));
728}
729
730/*
731 * Allocating quota on disk if needed.
Brian Foster410b11a2014-02-07 14:55:54 +1100732 * the write transaction log space for quota file extent allocation
Dave Chinner7fd36c42013-08-12 20:49:32 +1000733 * the unit of quota allocation: one system block size
734 */
735STATIC uint
736xfs_calc_qm_dqalloc_reservation(
737 struct xfs_mount *mp)
738{
Brian Foster410b11a2014-02-07 14:55:54 +1100739 return xfs_calc_write_reservation(mp) +
Dave Chinner7fd36c42013-08-12 20:49:32 +1000740 xfs_calc_buf_res(1,
741 XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1);
742}
743
744/*
745 * Turning off quotas.
746 * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2
747 * the superblock for the quota flags: sector size
748 */
749STATIC uint
750xfs_calc_qm_quotaoff_reservation(
751 struct xfs_mount *mp)
752{
753 return sizeof(struct xfs_qoff_logitem) * 2 +
754 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
755}
756
757/*
758 * End of turning off quotas.
759 * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2
760 */
761STATIC uint
Eric Sandeena1f69412018-04-06 10:09:42 -0700762xfs_calc_qm_quotaoff_end_reservation(void)
Dave Chinner7fd36c42013-08-12 20:49:32 +1000763{
764 return sizeof(struct xfs_qoff_logitem) * 2;
765}
766
767/*
768 * Syncing the incore super block changes to disk.
769 * the super block to reflect the changes: sector size
770 */
771STATIC uint
772xfs_calc_sb_reservation(
773 struct xfs_mount *mp)
774{
775 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
776}
777
778void
779xfs_trans_resv_calc(
780 struct xfs_mount *mp,
781 struct xfs_trans_resv *resp)
782{
Jie Liu0eadd102013-08-12 20:49:56 +1000783 /*
784 * The following transactions are logged in physical format and
785 * require a permanent reservation on space.
786 */
787 resp->tr_write.tr_logres = xfs_calc_write_reservation(mp);
Darrick J. Wong80de4622016-10-03 09:11:47 -0700788 if (xfs_sb_version_hasreflink(&mp->m_sb))
789 resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT_REFLINK;
790 else
791 resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT;
Jie Liu0eadd102013-08-12 20:49:56 +1000792 resp->tr_write.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
793
794 resp->tr_itruncate.tr_logres = xfs_calc_itruncate_reservation(mp);
Darrick J. Wong80de4622016-10-03 09:11:47 -0700795 if (xfs_sb_version_hasreflink(&mp->m_sb))
796 resp->tr_itruncate.tr_logcount =
797 XFS_ITRUNCATE_LOG_COUNT_REFLINK;
798 else
799 resp->tr_itruncate.tr_logcount = XFS_ITRUNCATE_LOG_COUNT;
Jie Liu0eadd102013-08-12 20:49:56 +1000800 resp->tr_itruncate.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
801
802 resp->tr_rename.tr_logres = xfs_calc_rename_reservation(mp);
803 resp->tr_rename.tr_logcount = XFS_RENAME_LOG_COUNT;
804 resp->tr_rename.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
805
806 resp->tr_link.tr_logres = xfs_calc_link_reservation(mp);
807 resp->tr_link.tr_logcount = XFS_LINK_LOG_COUNT;
808 resp->tr_link.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
809
810 resp->tr_remove.tr_logres = xfs_calc_remove_reservation(mp);
811 resp->tr_remove.tr_logcount = XFS_REMOVE_LOG_COUNT;
812 resp->tr_remove.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
813
814 resp->tr_symlink.tr_logres = xfs_calc_symlink_reservation(mp);
815 resp->tr_symlink.tr_logcount = XFS_SYMLINK_LOG_COUNT;
816 resp->tr_symlink.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
817
Brian Fosterc017cb52018-01-08 10:41:38 -0800818 resp->tr_create.tr_logres = xfs_calc_icreate_reservation(mp);
Jie Liu0eadd102013-08-12 20:49:56 +1000819 resp->tr_create.tr_logcount = XFS_CREATE_LOG_COUNT;
820 resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
821
Zhi Yong Wu99b64362013-12-18 08:22:40 +0800822 resp->tr_create_tmpfile.tr_logres =
823 xfs_calc_create_tmpfile_reservation(mp);
824 resp->tr_create_tmpfile.tr_logcount = XFS_CREATE_TMPFILE_LOG_COUNT;
825 resp->tr_create_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
826
Jie Liu0eadd102013-08-12 20:49:56 +1000827 resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp);
828 resp->tr_mkdir.tr_logcount = XFS_MKDIR_LOG_COUNT;
829 resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
830
831 resp->tr_ifree.tr_logres = xfs_calc_ifree_reservation(mp);
832 resp->tr_ifree.tr_logcount = XFS_INACTIVE_LOG_COUNT;
833 resp->tr_ifree.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
834
835 resp->tr_addafork.tr_logres = xfs_calc_addafork_reservation(mp);
836 resp->tr_addafork.tr_logcount = XFS_ADDAFORK_LOG_COUNT;
837 resp->tr_addafork.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
838
839 resp->tr_attrinval.tr_logres = xfs_calc_attrinval_reservation(mp);
840 resp->tr_attrinval.tr_logcount = XFS_ATTRINVAL_LOG_COUNT;
841 resp->tr_attrinval.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
842
843 resp->tr_attrsetm.tr_logres = xfs_calc_attrsetm_reservation(mp);
844 resp->tr_attrsetm.tr_logcount = XFS_ATTRSET_LOG_COUNT;
845 resp->tr_attrsetm.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
846
847 resp->tr_attrrm.tr_logres = xfs_calc_attrrm_reservation(mp);
848 resp->tr_attrrm.tr_logcount = XFS_ATTRRM_LOG_COUNT;
849 resp->tr_attrrm.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
850
851 resp->tr_growrtalloc.tr_logres = xfs_calc_growrtalloc_reservation(mp);
852 resp->tr_growrtalloc.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT;
853 resp->tr_growrtalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
854
855 resp->tr_qm_dqalloc.tr_logres = xfs_calc_qm_dqalloc_reservation(mp);
Darrick J. Wong80de4622016-10-03 09:11:47 -0700856 if (xfs_sb_version_hasreflink(&mp->m_sb))
857 resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT_REFLINK;
858 else
859 resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT;
Jie Liu0eadd102013-08-12 20:49:56 +1000860 resp->tr_qm_dqalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
861
862 /*
863 * The following transactions are logged in logical format with
864 * a default log count.
865 */
Eric Sandeena1f69412018-04-06 10:09:42 -0700866 resp->tr_qm_setqlim.tr_logres = xfs_calc_qm_setqlim_reservation();
Jie Liu0eadd102013-08-12 20:49:56 +1000867 resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT;
868
869 resp->tr_qm_quotaoff.tr_logres = xfs_calc_qm_quotaoff_reservation(mp);
870 resp->tr_qm_quotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT;
871
872 resp->tr_qm_equotaoff.tr_logres =
Eric Sandeena1f69412018-04-06 10:09:42 -0700873 xfs_calc_qm_quotaoff_end_reservation();
Jie Liu0eadd102013-08-12 20:49:56 +1000874 resp->tr_qm_equotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT;
875
876 resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp);
877 resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT;
878
879 /* The following transaction are logged in logical format */
880 resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp);
881 resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp);
Jie Liu20996c92013-08-12 20:49:57 +1000882 resp->tr_fsyncts.tr_logres = xfs_calc_swrite_reservation(mp);
Jie Liu0eadd102013-08-12 20:49:56 +1000883 resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp);
884 resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp);
885 resp->tr_clearagi.tr_logres = xfs_calc_clear_agi_bucket_reservation(mp);
886 resp->tr_growrtzero.tr_logres = xfs_calc_growrtzero_reservation(mp);
887 resp->tr_growrtfree.tr_logres = xfs_calc_growrtfree_reservation(mp);
Dave Chinner7fd36c42013-08-12 20:49:32 +1000888}