aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_resv.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_trans_resv.c')
-rw-r--r--fs/xfs/xfs_trans_resv.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/fs/xfs/xfs_trans_resv.c b/fs/xfs/xfs_trans_resv.c
index 2fd59c0dae66..bd3b4b7831b7 100644
--- a/fs/xfs/xfs_trans_resv.c
+++ b/fs/xfs/xfs_trans_resv.c
@@ -229,6 +229,18 @@ xfs_calc_link_reservation(
229} 229}
230 230
231/* 231/*
232 * For adding an inode to unlinked list we can modify:
233 * the agi hash list: sector size
234 * the unlinked inode: inode size
235 */
236STATIC uint
237xfs_calc_iunlink_add_reservation(xfs_mount_t *mp)
238{
239 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
240 xfs_calc_inode_res(mp, 1);
241}
242
243/*
232 * For removing a directory entry we can modify: 244 * For removing a directory entry we can modify:
233 * the parent directory inode: inode size 245 * the parent directory inode: inode size
234 * the removed inode: inode size 246 * the removed inode: inode size
@@ -245,10 +257,11 @@ xfs_calc_remove_reservation(
245 struct xfs_mount *mp) 257 struct xfs_mount *mp)
246{ 258{
247 return XFS_DQUOT_LOGRES(mp) + 259 return XFS_DQUOT_LOGRES(mp) +
248 MAX((xfs_calc_inode_res(mp, 2) + 260 xfs_calc_iunlink_add_reservation(mp) +
261 MAX((xfs_calc_inode_res(mp, 1) +
249 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), 262 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
250 XFS_FSB_TO_B(mp, 1))), 263 XFS_FSB_TO_B(mp, 1))),
251 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + 264 (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) +
252 xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 2), 265 xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 2),
253 XFS_FSB_TO_B(mp, 1)))); 266 XFS_FSB_TO_B(mp, 1))));
254} 267}
@@ -343,6 +356,20 @@ xfs_calc_create_reservation(
343 356
344} 357}
345 358
359STATIC uint
360xfs_calc_create_tmpfile_reservation(
361 struct xfs_mount *mp)
362{
363 uint res = XFS_DQUOT_LOGRES(mp);
364
365 if (xfs_sb_version_hascrc(&mp->m_sb))
366 res += xfs_calc_icreate_resv_alloc(mp);
367 else
368 res += xfs_calc_create_resv_alloc(mp);
369
370 return res + xfs_calc_iunlink_add_reservation(mp);
371}
372
346/* 373/*
347 * Making a new directory is the same as creating a new file. 374 * Making a new directory is the same as creating a new file.
348 */ 375 */
@@ -729,6 +756,11 @@ xfs_trans_resv_calc(
729 resp->tr_create.tr_logcount = XFS_CREATE_LOG_COUNT; 756 resp->tr_create.tr_logcount = XFS_CREATE_LOG_COUNT;
730 resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES; 757 resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
731 758
759 resp->tr_create_tmpfile.tr_logres =
760 xfs_calc_create_tmpfile_reservation(mp);
761 resp->tr_create_tmpfile.tr_logcount = XFS_CREATE_TMPFILE_LOG_COUNT;
762 resp->tr_create_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
763
732 resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp); 764 resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp);
733 resp->tr_mkdir.tr_logcount = XFS_MKDIR_LOG_COUNT; 765 resp->tr_mkdir.tr_logcount = XFS_MKDIR_LOG_COUNT;
734 resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES; 766 resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES;