|
@@ -203,6 +203,20 @@ xfs_calc_rename_reservation(
|
|
|
XFS_FSB_TO_B(mp, 1))));
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * For removing an inode from unlinked list at first, we can modify:
|
|
|
+ * the agi hash list and counters: sector size
|
|
|
+ * the on disk inode before ours in the agi hash list: inode cluster size
|
|
|
+ */
|
|
|
+STATIC uint
|
|
|
+xfs_calc_iunlink_remove_reservation(
|
|
|
+ struct xfs_mount *mp)
|
|
|
+{
|
|
|
+ return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
|
|
|
+ MAX((__uint16_t)XFS_FSB_TO_B(mp, 1),
|
|
|
+ (__uint16_t)XFS_INODE_CLUSTER_SIZE(mp));
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* For creating a link to an inode:
|
|
|
* the parent directory inode: inode size
|
|
@@ -220,6 +234,7 @@ xfs_calc_link_reservation(
|
|
|
struct xfs_mount *mp)
|
|
|
{
|
|
|
return XFS_DQUOT_LOGRES(mp) +
|
|
|
+ xfs_calc_iunlink_remove_reservation(mp) +
|
|
|
MAX((xfs_calc_inode_res(mp, 2) +
|
|
|
xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
|
|
|
XFS_FSB_TO_B(mp, 1))),
|
|
@@ -410,9 +425,9 @@ xfs_calc_ifree_reservation(
|
|
|
{
|
|
|
return XFS_DQUOT_LOGRES(mp) +
|
|
|
xfs_calc_inode_res(mp, 1) +
|
|
|
- xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
|
|
|
+ xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
|
|
|
xfs_calc_buf_res(1, XFS_FSB_TO_B(mp, 1)) +
|
|
|
- max_t(uint, XFS_FSB_TO_B(mp, 1), XFS_INODE_CLUSTER_SIZE(mp)) +
|
|
|
+ xfs_calc_iunlink_remove_reservation(mp) +
|
|
|
xfs_calc_buf_res(1, 0) +
|
|
|
xfs_calc_buf_res(2 + XFS_IALLOC_BLOCKS(mp) +
|
|
|
mp->m_in_maxlevels, 0) +
|