summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-07-09 20:56:06 +0300
committerDarrick J. Wong <djwong@kernel.org>2022-07-10 01:17:21 +0300
commite45d7cb2356e6b59fe64da28324025cc6fcd3fbd (patch)
tree19d84f0fc674b316e04ed33854262623c42fa4cc /fs/xfs/xfs_inode.c
parent2ed5b09b3e8fc274ae8fecd6ab7c5106a364bed1 (diff)
downloadlinux-e45d7cb2356e6b59fe64da28324025cc6fcd3fbd.tar.xz
xfs: use XFS_IFORK_Q to determine the presence of an xattr fork
Modify xfs_ifork_ptr to return a NULL pointer if the caller asks for the attribute fork but i_forkoff is zero. This eliminates the ambiguity between i_forkoff and i_af.if_present, which should make it easier to understand the lifetime of attr forks. While we're at it, remove the if_present checks around calls to xfs_idestroy_fork and xfs_ifork_zap_attr since they can both handle attr forks that have already been torn down. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index f5e553168b42..699c44f57707 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -125,7 +125,7 @@ xfs_ilock_attr_map_shared(
{
uint lock_mode = XFS_ILOCK_SHARED;
- if (ip->i_af.if_present && xfs_need_iread_extents(&ip->i_af))
+ if (XFS_IFORK_Q(ip) && xfs_need_iread_extents(&ip->i_af))
lock_mode = XFS_ILOCK_EXCL;
xfs_ilock(ip, lock_mode);
return lock_mode;
@@ -1768,7 +1768,6 @@ xfs_inactive(
goto out;
}
- ASSERT(!ip->i_af.if_present);
ASSERT(ip->i_forkoff == 0);
/*
@@ -3502,7 +3501,7 @@ xfs_iflush(
if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL &&
xfs_ifork_verify_local_data(ip))
goto flush_out;
- if (ip->i_af.if_present &&
+ if (XFS_IFORK_Q(ip) &&
ip->i_af.if_format == XFS_DINODE_FMT_LOCAL &&
xfs_ifork_verify_local_attr(ip))
goto flush_out;