summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_trans_space.c
diff options
context:
space:
mode:
authorAllison Henderson <allison.henderson@oracle.com>2024-04-22 19:47:50 +0300
committerDarrick J. Wong <djwong@kernel.org>2024-04-23 17:46:59 +0300
commit5a8338c88284df4e9e697225aa65f2709333a659 (patch)
tree8df45a277f1eb0b7a46616ccd30f1f5eda997b4b /fs/xfs/libxfs/xfs_trans_space.c
parentd2d18330f63cd70b50eddac76de7c59a36f2faa7 (diff)
downloadlinux-5a8338c88284df4e9e697225aa65f2709333a659.tar.xz
xfs: Add parent pointers to rename
This patch removes the old parent pointer attribute during the rename operation, and re-adds the updated parent pointer. Signed-off-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> [djwong: adjust to new ondisk format] Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/libxfs/xfs_trans_space.c')
-rw-r--r--fs/xfs/libxfs/xfs_trans_space.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_trans_space.c b/fs/xfs/libxfs/xfs_trans_space.c
index df729e4f1a4c..b9dc3752f702 100644
--- a/fs/xfs/libxfs/xfs_trans_space.c
+++ b/fs/xfs/libxfs/xfs_trans_space.c
@@ -94,3 +94,28 @@ xfs_remove_space_res(
return ret;
}
+
+unsigned int
+xfs_rename_space_res(
+ struct xfs_mount *mp,
+ unsigned int src_namelen,
+ bool target_exists,
+ unsigned int target_namelen,
+ bool has_whiteout)
+{
+ unsigned int ret;
+
+ ret = XFS_DIRREMOVE_SPACE_RES(mp) +
+ XFS_DIRENTER_SPACE_RES(mp, target_namelen);
+
+ if (xfs_has_parent(mp)) {
+ if (has_whiteout)
+ ret += xfs_parent_calc_space_res(mp, src_namelen);
+ ret += 2 * xfs_parent_calc_space_res(mp, target_namelen);
+ }
+
+ if (target_exists)
+ ret += xfs_parent_calc_space_res(mp, target_namelen);
+
+ return ret;
+}