]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: add parent attributes to symlink
authorAllison Henderson <allison.henderson@oracle.com>
Tue, 9 Jan 2024 17:39:21 +0000 (09:39 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 10 Apr 2024 00:21:29 +0000 (17:21 -0700)
This patch modifies xfs_symlink to add a parent pointer to the inode.

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
[djwong: minor rebase fixups]
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/xfs_trans_space.c
libxfs/xfs_trans_space.h

index 039bbd91e872882a18ae51231f033f2078c53d68..bf4a41492c2274d27165d34df3cf879790b12261 100644 (file)
@@ -64,3 +64,20 @@ xfs_link_space_res(
 
        return ret;
 }
+
+unsigned int
+xfs_symlink_space_res(
+       struct xfs_mount        *mp,
+       unsigned int            namelen,
+       unsigned int            fsblocks)
+{
+       unsigned int            ret;
+
+       ret = XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp, namelen) +
+                       fsblocks;
+
+       if (xfs_has_parent(mp))
+               ret += xfs_parent_calc_space_res(mp, namelen);
+
+       return ret;
+}
index 5539634009fb2b8e7d32032838088969569a477f..354ad1d6e18d6c584d927eb0ae1edf35434cf677 100644 (file)
@@ -95,8 +95,6 @@
        XFS_DIRREMOVE_SPACE_RES(mp)
 #define        XFS_RENAME_SPACE_RES(mp,nl)     \
        (XFS_DIRREMOVE_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl))
-#define        XFS_SYMLINK_SPACE_RES(mp,nl,b)  \
-       (XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl) + (b))
 #define XFS_IFREE_SPACE_RES(mp)                \
        (xfs_has_finobt(mp) ? M_IGEO(mp)->inobt_maxlevels : 0)
 
@@ -106,5 +104,7 @@ unsigned int xfs_parent_calc_space_res(struct xfs_mount *mp,
 unsigned int xfs_create_space_res(struct xfs_mount *mp, unsigned int namelen);
 unsigned int xfs_mkdir_space_res(struct xfs_mount *mp, unsigned int namelen);
 unsigned int xfs_link_space_res(struct xfs_mount *mp, unsigned int namelen);
+unsigned int xfs_symlink_space_res(struct xfs_mount *mp, unsigned int namelen,
+               unsigned int fsblocks);
 
 #endif /* __XFS_TRANS_SPACE_H__ */