Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Chandan Babu R <chandan.babu@oracle.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 5/8] xfs: remove xfs_attr_shortform_lookup
Date: Mon, 18 Dec 2023 14:37:25 -0800	[thread overview]
Message-ID: <20231218223725.GA361584@frogsfrogsfrogs> (raw)
In-Reply-To: <20231217170350.605812-6-hch@lst.de>

On Sun, Dec 17, 2023 at 06:03:47PM +0100, Christoph Hellwig wrote:
> xfs_attr_shortform_lookup is only used by xfs_attr_shortform_addname,
> which is much better served by calling xfs_attr_sf_findname.  Switch
> it over and remove xfs_attr_shortform_lookup.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_attr.c      | 16 ++++------------
>  fs/xfs/libxfs/xfs_attr_leaf.c | 24 ------------------------
>  fs/xfs/libxfs/xfs_attr_leaf.h |  1 -
>  3 files changed, 4 insertions(+), 37 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index bcf8748cb1a333..d6173888ed0d56 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -1070,13 +1070,7 @@ xfs_attr_shortform_addname(
>  
>  	trace_xfs_attr_sf_addname(args);
>  
> -	error = xfs_attr_shortform_lookup(args);
> -	switch (error) {
> -	case -ENOATTR:
> -		if (args->op_flags & XFS_DA_OP_REPLACE)
> -			return error;
> -		break;
> -	case -EEXIST:
> +	if (xfs_attr_sf_findname(args)) {
>  		if (!(args->op_flags & XFS_DA_OP_REPLACE))
>  			return error;
>  
> @@ -1091,11 +1085,9 @@ xfs_attr_shortform_addname(
>  		 * around.
>  		 */
>  		args->op_flags &= ~XFS_DA_OP_REPLACE;
> -		break;
> -	case 0:
> -		break;
> -	default:
> -		return error;
> +	} else {
> +		if (args->op_flags & XFS_DA_OP_REPLACE)
> +			return error;
>  	}
>  
>  	if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
> index 7a623efd23a6a4..75c597805ffa8b 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
> @@ -837,30 +837,6 @@ xfs_attr_sf_removename(
>  	return 0;
>  }
>  
> -/*
> - * Look up a name in a shortform attribute list structure.
> - */
> -/*ARGSUSED*/
> -int
> -xfs_attr_shortform_lookup(
> -	struct xfs_da_args		*args)
> -{
> -	struct xfs_ifork		*ifp = &args->dp->i_af;
> -	struct xfs_attr_shortform	*sf = ifp->if_data;
> -	struct xfs_attr_sf_entry	*sfe;
> -	int				i;
> -
> -	ASSERT(ifp->if_format == XFS_DINODE_FMT_LOCAL);
> -	sfe = &sf->list[0];
> -	for (i = 0; i < sf->hdr.count;
> -				sfe = xfs_attr_sf_nextentry(sfe), i++) {
> -		if (xfs_attr_match(args, sfe->namelen, sfe->nameval,
> -				sfe->flags))
> -			return -EEXIST;
> -	}
> -	return -ENOATTR;
> -}
> -
>  /*
>   * Retrieve the attribute value and length.
>   *
> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.h b/fs/xfs/libxfs/xfs_attr_leaf.h
> index 56fcd689eedfe7..35e668ae744fb1 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.h
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.h
> @@ -47,7 +47,6 @@ struct xfs_attr3_icleaf_hdr {
>   */
>  void	xfs_attr_shortform_create(struct xfs_da_args *args);
>  void	xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
> -int	xfs_attr_shortform_lookup(struct xfs_da_args *args);
>  int	xfs_attr_shortform_getvalue(struct xfs_da_args *args);
>  int	xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
>  int	xfs_attr_sf_removename(struct xfs_da_args *args);
> -- 
> 2.39.2
> 
> 

  reply	other threads:[~2023-12-18 22:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-17 17:03 attr cleanups Christoph Hellwig
2023-12-17 17:03 ` [PATCH 1/8] xfs: make if_data a void pointer Christoph Hellwig
2023-12-18 22:31   ` Darrick J. Wong
2023-12-19  4:20     ` Christoph Hellwig
2023-12-19  4:48       ` Darrick J. Wong
2023-12-17 17:03 ` [PATCH 2/8] xfs: return if_data from xfs_idata_realloc Christoph Hellwig
2023-12-18 22:29   ` Darrick J. Wong
2023-12-17 17:03 ` [PATCH 3/8] xfs: move the xfs_attr_sf_lookup tracepoint Christoph Hellwig
2023-12-18 22:39   ` Darrick J. Wong
2023-12-19  4:21     ` Christoph Hellwig
2023-12-19  4:52       ` Darrick J. Wong
2023-12-17 17:03 ` [PATCH 4/8] xfs: simplify xfs_attr_sf_findname Christoph Hellwig
2023-12-18 22:35   ` Darrick J. Wong
2023-12-17 17:03 ` [PATCH 5/8] xfs: remove xfs_attr_shortform_lookup Christoph Hellwig
2023-12-18 22:37   ` Darrick J. Wong [this message]
2023-12-17 17:03 ` [PATCH 6/8] xfs: use xfs_attr_sf_findname in xfs_attr_shortform_getvalue Christoph Hellwig
2023-12-18 22:37   ` Darrick J. Wong
2023-12-17 17:03 ` [PATCH 7/8] xfs: remove struct xfs_attr_shortform Christoph Hellwig
2023-12-17 21:12   ` Dave Chinner
2023-12-18  4:30     ` Christoph Hellwig
2023-12-18 22:41       ` Darrick J. Wong
2023-12-17 17:03 ` [PATCH 8/8] xfs: remove xfs_attr_sf_hdr_t Christoph Hellwig
2023-12-18 22:39   ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2023-12-19 12:08 attr cleanups v2 Christoph Hellwig
2023-12-19 12:08 ` [PATCH 5/8] xfs: remove xfs_attr_shortform_lookup Christoph Hellwig
2023-12-19 14:46   ` Christoph Hellwig
2023-12-19 17:45     ` Darrick J. Wong
2023-12-20  3:55       ` Christoph Hellwig

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=20231218223725.GA361584@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=chandan.babu@oracle.com \
    --cc=hch@lst.de \
    --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