xfs: cleanup xfs_idestroy_fork

Move freeing the dynamically allocated attr and COW fork, as well
as zeroing the pointers where actually needed into the callers, and
just pass the xfs_ifork structure to xfs_idestroy_fork.  Also simplify
the kmem_free calls by not checking for NULL first.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
Christoph Hellwig
2020-05-18 10:29:27 -07:00
committed by Darrick J. Wong
parent f7e67b20ec
commit ef8385128d
6 changed files with 28 additions and 37 deletions

View File

@@ -717,11 +717,10 @@ xfs_attr_fork_remove(
{
ASSERT(ip->i_afp->if_nextents == 0);
xfs_idestroy_fork(ip, XFS_ATTR_FORK);
xfs_idestroy_fork(ip->i_afp);
kmem_cache_free(xfs_ifork_zone, ip->i_afp);
ip->i_afp = NULL;
ip->i_d.di_forkoff = 0;
ASSERT(ip->i_afp == NULL);
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
}