Skip to content

Commit b2c2004

Browse files
Christoph Hellwigdjwong
authored andcommitted
xfs: remove xfs_ifree_local_data
xfs_ifree only need to free inline data in the data fork, as we've already taken care of the attr fork before (and in fact freed the fork structure). Just open code the freeing of the inline data. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Brian Foster <[email protected]> Reviewed-by: Chandan Babu R <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 09c38ed commit b2c2004

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

fs/xfs/xfs_inode.c

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,24 +2711,6 @@ xfs_ifree_cluster(
27112711
return 0;
27122712
}
27132713

2714-
/*
2715-
* Free any local-format buffers sitting around before we reset to
2716-
* extents format.
2717-
*/
2718-
static inline void
2719-
xfs_ifree_local_data(
2720-
struct xfs_inode *ip,
2721-
int whichfork)
2722-
{
2723-
struct xfs_ifork *ifp;
2724-
2725-
if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL)
2726-
return;
2727-
2728-
ifp = XFS_IFORK_PTR(ip, whichfork);
2729-
xfs_idata_realloc(ip, -ifp->if_bytes, whichfork);
2730-
}
2731-
27322714
/*
27332715
* This is called to return an inode to the inode free list.
27342716
* The inode should already be truncated to 0 length and have
@@ -2765,8 +2747,16 @@ xfs_ifree(
27652747
if (error)
27662748
return error;
27672749

2768-
xfs_ifree_local_data(ip, XFS_DATA_FORK);
2769-
xfs_ifree_local_data(ip, XFS_ATTR_FORK);
2750+
/*
2751+
* Free any local-format data sitting around before we reset the
2752+
* data fork to extents format. Note that the attr fork data has
2753+
* already been freed by xfs_attr_inactive.
2754+
*/
2755+
if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
2756+
kmem_free(ip->i_df.if_u1.if_data);
2757+
ip->i_df.if_u1.if_data = NULL;
2758+
ip->i_df.if_bytes = 0;
2759+
}
27702760

27712761
VFS_I(ip)->i_mode = 0; /* mark incore inode as free */
27722762
ip->i_d.di_flags = 0;

0 commit comments

Comments
 (0)