Skip to content

Commit 605e74e

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: simplify xfs_attr_remove_args
Directly return from the subfunctions and avoid the error variable. Also remove the not really needed dp local variable. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Brian Foster <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 2ac131d commit 605e74e

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -386,21 +386,16 @@ int
386386
xfs_attr_remove_args(
387387
struct xfs_da_args *args)
388388
{
389-
struct xfs_inode *dp = args->dp;
390-
int error;
389+
if (!xfs_inode_hasattr(args->dp))
390+
return -ENOATTR;
391391

392-
if (!xfs_inode_hasattr(dp)) {
393-
error = -ENOATTR;
394-
} else if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) {
395-
ASSERT(dp->i_afp->if_flags & XFS_IFINLINE);
396-
error = xfs_attr_shortform_remove(args);
397-
} else if (xfs_attr_is_leaf(dp)) {
398-
error = xfs_attr_leaf_removename(args);
399-
} else {
400-
error = xfs_attr_node_removename(args);
392+
if (args->dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) {
393+
ASSERT(args->dp->i_afp->if_flags & XFS_IFINLINE);
394+
return xfs_attr_shortform_remove(args);
401395
}
402-
403-
return error;
396+
if (xfs_attr_is_leaf(args->dp))
397+
return xfs_attr_leaf_removename(args);
398+
return xfs_attr_node_removename(args);
404399
}
405400

406401
/*

0 commit comments

Comments
 (0)