xfs: increase rename inode reservation
authorAllison Henderson <allison.henderson@oracle.com>
Tue, 25 Oct 2022 19:16:27 +0000 (12:16 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 26 Oct 2022 20:02:24 +0000 (13:02 -0700)
xfs_rename can update up to 5 inodes: src_dp, target_dp, src_ip, target_ip
and wip.  So we need to increase the inode reservation to match.

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/libxfs/xfs_trans_resv.c
fs/xfs/xfs_inode.c

index 2c4ad6e4bb1498be85d66998ec01e4c7ddb61a69..5b2f27cbdb8089d9386cf144288d960777f9d7de 100644 (file)
@@ -422,7 +422,7 @@ xfs_calc_itruncate_reservation_minlogsize(
 
 /*
  * In renaming a files we can modify:
- *    the four inodes involved: 4 * inode size
+ *    the five inodes involved: 5 * inode size
  *    the two directory btrees: 2 * (max depth + v2) * dir block size
  *    the two directory bmap btrees: 2 * max depth * block size
  * And the bmap_finish transaction can free dir and bmap blocks (two sets
@@ -437,7 +437,7 @@ xfs_calc_rename_reservation(
        struct xfs_mount        *mp)
 {
        return XFS_DQUOT_LOGRES(mp) +
-               max((xfs_calc_inode_res(mp, 4) +
+               max((xfs_calc_inode_res(mp, 5) +
                     xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp),
                                      XFS_FSB_TO_B(mp, 1))),
                    (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) +
index c000b74dd203582517081fe253d770b8205493fb..aa303be11576ffb04b31a29a187529b38d533f04 100644 (file)
@@ -2818,7 +2818,7 @@ retry:
         * Lock all the participating inodes. Depending upon whether
         * the target_name exists in the target directory, and
         * whether the target directory is the same as the source
-        * directory, we can lock from 2 to 4 inodes.
+        * directory, we can lock from 2 to 5 inodes.
         */
        xfs_lock_inodes(inodes, num_inodes, XFS_ILOCK_EXCL);