All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Allison Henderson <allison.henderson@oracle.com>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/7] xfs: clean up xfs_attr_node_hasname
Date: Fri, 20 May 2022 13:42:10 +1000	[thread overview]
Message-ID: <20220520034210.GD1098723@dread.disaster.area> (raw)
In-Reply-To: <165290014984.1647637.6457441230229883518.stgit@magnolia>

On Wed, May 18, 2022 at 11:55:49AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> The calling conventions of this function are a mess -- callers /can/
> provide a pointer to a pointer to a state structure, but it's not
> required, and as evidenced by the last two patches, the callers that do
> weren't be careful enough about how to deal with an existing da state.
> 
> Push the allocation and freeing responsibilty to the callers, which
> means that callers from the xattr node state machine steps now have the
> visibility to allocate or free the da state structure as they please.
> As a bonus, the node remove/add paths for larp-mode replaces can reset
> the da state structure instead of freeing and immediately reallocating
> it.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
> ---
>  fs/xfs/libxfs/xfs_attr.c     |   63 +++++++++++++++++++++---------------------
>  fs/xfs/libxfs/xfs_da_btree.c |   11 +++++++
>  fs/xfs/libxfs/xfs_da_btree.h |    1 +
>  3 files changed, 44 insertions(+), 31 deletions(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 576de34cfca0..3838109ef288 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -61,8 +61,8 @@ STATIC void xfs_attr_restore_rmt_blk(struct xfs_da_args *args);
>  static int xfs_attr_node_try_addname(struct xfs_attr_item *attr);
>  STATIC int xfs_attr_node_addname_find_attr(struct xfs_attr_item *attr);
>  STATIC int xfs_attr_node_remove_attr(struct xfs_attr_item *attr);
> -STATIC int xfs_attr_node_hasname(xfs_da_args_t *args,
> -				 struct xfs_da_state **state);
> +STATIC int xfs_attr_node_lookup(struct xfs_da_args *args,
> +		struct xfs_da_state *state);
>  
>  int
>  xfs_inode_hasattr(
> @@ -594,6 +594,19 @@ xfs_attr_leaf_mark_incomplete(
>  	return xfs_attr3_leaf_setflag(args);
>  }
>  
> +/* Ensure the da state of an xattr deferred work item is ready to go. */
> +static inline void
> +xfs_attr_item_ensure_da_state(

xfs_attr_item_init_da_state().

Other than that, it's a nice cleanup. I can rename the function
locally if you want.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2022-05-20  3:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 18:55 [PATCHSET v2 0/7] xfs: cleanups for logged xattr updates Darrick J. Wong
2022-05-18 18:55 ` [PATCH 1/7] xfs: clean up xfs_attr_node_hasname Darrick J. Wong
2022-05-20  3:42   ` Dave Chinner [this message]
2022-05-20 15:49     ` Darrick J. Wong
2022-05-18 18:55 ` [PATCH 2/7] xfs: put the xattr intent item op flags in their own namespace Darrick J. Wong
2022-05-19 20:34   ` Alli
2022-05-20  3:42   ` Dave Chinner
2022-05-18 18:56 ` [PATCH 3/7] xfs: use a separate slab cache for deferred xattr work state Darrick J. Wong
2022-05-20  3:50   ` Dave Chinner
2022-05-18 18:56 ` [PATCH 4/7] xfs: remove struct xfs_attr_item.xattri_flags Darrick J. Wong
2022-05-20  4:07   ` Dave Chinner
2022-05-18 18:56 ` [PATCH 5/7] xfs: put attr[id] log item cache init with the others Darrick J. Wong
2022-05-20  4:08   ` Dave Chinner
2022-05-18 18:56 ` [PATCH 6/7] xfs: clean up state variable usage in xfs_attr_node_remove_attr Darrick J. Wong
2022-05-19 20:34   ` Alli
2022-05-20  4:09   ` Dave Chinner
2022-05-18 18:56 ` [PATCH 7/7] xfs: rename struct xfs_attr_item to xfs_attr_intent Darrick J. Wong
2022-05-20  4:10   ` Dave Chinner

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=20220520034210.GD1098723@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=allison.henderson@oracle.com \
    --cc=djwong@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.