xfs: remove the xfs_inode argument to xfs_attr_get_ilocked
authorChristoph Hellwig <hch@lst.de>
Thu, 27 Feb 2020 01:30:34 +0000 (17:30 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 3 Mar 2020 04:55:53 +0000 (20:55 -0800)
The inode can easily be derived from the args structure.  Also
don't bother with else statements after early returns.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_attr.c
fs/xfs/libxfs/xfs_attr.h
fs/xfs/scrub/attr.c

index 288b39e..fd095e3 100644 (file)
@@ -77,19 +77,18 @@ xfs_inode_hasattr(
  */
 int
 xfs_attr_get_ilocked(
-       struct xfs_inode        *ip,
        struct xfs_da_args      *args)
 {
-       ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED | XFS_ILOCK_EXCL));
+       ASSERT(xfs_isilocked(args->dp, XFS_ILOCK_SHARED | XFS_ILOCK_EXCL));
 
-       if (!xfs_inode_hasattr(ip))
+       if (!xfs_inode_hasattr(args->dp))
                return -ENOATTR;
-       else if (ip->i_d.di_aformat == XFS_DINODE_FMT_LOCAL)
+
+       if (args->dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL)
                return xfs_attr_shortform_getvalue(args);
-       else if (xfs_bmap_one_block(ip, XFS_ATTR_FORK))
+       if (xfs_bmap_one_block(args->dp, XFS_ATTR_FORK))
                return xfs_attr_leaf_get(args);
-       else
-               return xfs_attr_node_get(args);
+       return xfs_attr_node_get(args);
 }
 
 /*
@@ -133,7 +132,7 @@ xfs_attr_get(
                args->op_flags |= XFS_DA_OP_ALLOCVAL;
 
        lock_mode = xfs_ilock_attr_map_shared(args->dp);
-       error = xfs_attr_get_ilocked(args->dp, args);
+       error = xfs_attr_get_ilocked(args);
        xfs_iunlock(args->dp, lock_mode);
 
        /* on error, we have to clean up allocated value buffers */
index be77d13..b8c4ed2 100644 (file)
@@ -145,7 +145,7 @@ int xfs_attr_inactive(struct xfs_inode *dp);
 int xfs_attr_list_int_ilocked(struct xfs_attr_list_context *);
 int xfs_attr_list_int(struct xfs_attr_list_context *);
 int xfs_inode_hasattr(struct xfs_inode *ip);
-int xfs_attr_get_ilocked(struct xfs_inode *ip, struct xfs_da_args *args);
+int xfs_attr_get_ilocked(struct xfs_da_args *args);
 int xfs_attr_get(struct xfs_da_args *args);
 int xfs_attr_set(struct xfs_da_args *args);
 int xfs_attr_set_args(struct xfs_da_args *args);
index d804558..f983c2b 100644 (file)
@@ -162,7 +162,7 @@ xchk_xattr_listent(
        args.value = xchk_xattr_valuebuf(sx->sc);
        args.valuelen = valuelen;
 
-       error = xfs_attr_get_ilocked(context->dp, &args);
+       error = xfs_attr_get_ilocked(&args);
        if (!xchk_fblock_process_error(sx->sc, XFS_ATTR_FORK, args.blkno,
                        &error))
                goto fail_xref;