linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Cc: Brian Foster <bfoster@redhat.com>
Subject: [PATCH 3/7] xfs: simplify xfs_attr_remove_args
Date: Mon, 12 Apr 2021 15:38:15 +0200	[thread overview]
Message-ID: <20210412133819.2618857-4-hch@lst.de> (raw)
In-Reply-To: <20210412133819.2618857-1-hch@lst.de>

Directly return from the subfunctions and avoid the error variable.  Also
remove the not really needed dp local variable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/libxfs/xfs_attr.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index fd61c67f573925..43ef85678cba6b 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -386,21 +386,16 @@ int
 xfs_attr_remove_args(
 	struct xfs_da_args      *args)
 {
-	struct xfs_inode	*dp = args->dp;
-	int			error;
+	if (!xfs_inode_hasattr(args->dp))
+		return -ENOATTR;
 
-	if (!xfs_inode_hasattr(dp)) {
-		error = -ENOATTR;
-	} else if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) {
-		ASSERT(dp->i_afp->if_flags & XFS_IFINLINE);
-		error = xfs_attr_shortform_remove(args);
-	} else if (xfs_attr_is_leaf(dp)) {
-		error = xfs_attr_leaf_removename(args);
-	} else {
-		error = xfs_attr_node_removename(args);
+	if (args->dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) {
+		ASSERT(args->dp->i_afp->if_flags & XFS_IFINLINE);
+		return xfs_attr_shortform_remove(args);
 	}
-
-	return error;
+	if (xfs_attr_is_leaf(args->dp))
+		return xfs_attr_leaf_removename(args);
+	return xfs_attr_node_removename(args);
 }
 
 /*
-- 
2.30.1


  parent reply	other threads:[~2021-04-12 13:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 13:38 remove the if_flags field in struct xfs_ifork Christoph Hellwig
2021-04-12 13:38 ` [PATCH 1/7] xfs: move the XFS_IFEXTENTS check into xfs_iread_extents Christoph Hellwig
2021-04-13 23:21   ` Darrick J. Wong
2021-04-12 13:38 ` [PATCH 2/7] xfs: rename and simplify xfs_bmap_one_block Christoph Hellwig
2021-04-14  0:05   ` Darrick J. Wong
2021-04-12 13:38 ` Christoph Hellwig [this message]
2021-04-14  0:06   ` [PATCH 3/7] xfs: simplify xfs_attr_remove_args Darrick J. Wong
2021-04-12 13:38 ` [PATCH 4/7] xfs: only look at the fork format in xfs_idestroy_fork Christoph Hellwig
2021-04-14  0:08   ` Darrick J. Wong
2021-04-12 13:38 ` [PATCH 5/7] xfs: remove XFS_IFBROOT Christoph Hellwig
2021-04-12 16:03   ` Brian Foster
2021-04-14 15:23     ` Darrick J. Wong
2021-04-14  0:13   ` Darrick J. Wong
2021-04-12 13:38 ` [PATCH 6/7] xfs: remove XFS_IFINLINE Christoph Hellwig
2021-04-12 16:03   ` Brian Foster
2021-04-14  0:33   ` Darrick J. Wong
2021-04-12 13:38 ` [PATCH 7/7] xfs: remove XFS_IFEXTENTS Christoph Hellwig
2021-04-12 16:03   ` Brian Foster
2021-04-14  0:37   ` Darrick J. Wong
2021-04-14  5:59     ` Christoph Hellwig
2021-04-14 15:27       ` Darrick J. Wong
2021-04-14 15:29         ` Christoph Hellwig
2021-04-15 23:14     ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2021-04-02 14:24 RFC: remove the if_flags field in struct xfs_ifork Christoph Hellwig
2021-04-02 14:24 ` [PATCH 3/7] xfs: simplify xfs_attr_remove_args Christoph Hellwig
2021-04-05 16:33   ` Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210412133819.2618857-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).