Re: [PATCH 28/29] xfs: remove XFS_DA_OP_INCOMPLETE

Darrick J. Wong
2020-01-21T19:45:54Z

On Tue, Jan 14, 2020 at 09:10:50AM +0100, Christoph Hellwig wrote:
> Now that we use the on-disk flags field also for the interface to the
> lower level attr routines we can use the XFS_ATTR_INCOMPLETE definition
> from the on-disk format directly instead.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

FWIW I think this looks right but I'll wait for you to confirm which
flagset go in which fields in the da_args structure.

--D

> ---
> fs/xfs/libxfs/xfs_attr.c | 2 +-
> fs/xfs/libxfs/xfs_attr_leaf.c | 15 ++++++---------
> fs/xfs/libxfs/xfs_types.h | 4 +---
> 3 files changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 2b9c0aa5af4a..20f791ea0aa3 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -894,7 +894,7 @@ xfs_attr_node_addname(
> * The INCOMPLETE flag means that we will find the "old"
> * attr, not the "new" one.
> */
> - args->op_flags |= XFS_DA_OP_INCOMPLETE;
> + args->attr_namespace |= XFS_ATTR_INCOMPLETE;
> state = xfs_da_state_alloc();
> state->args = args;
> state->mp = mp;
> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
> index 9081ba7af90a..fae322105457 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
> @@ -456,7 +456,12 @@ xfs_attr_match(
> return false;
> if (memcmp(args->name, name, namelen) != 0)
> return false;
> - if (args->attr_namespace != (flags & XFS_ATTR_NSP_ONDISK_MASK))
> + /*
> + * If we are looking for incomplete entries, show only those, else only
> + * show complete entries.
> + */
> + if (args->attr_namespace !=
> + (flags & (XFS_ATTR_NSP_ONDISK_MASK | XFS_ATTR_INCOMPLETE)))
> return false;
> return true;
> }
> @@ -2387,14 +2392,6 @@ xfs_attr3_leaf_lookup_int(
> /*
> * GROT: Add code to remove incomplete entries.
> */
> - /*
> - * If we are looking for INCOMPLETE entries, show only those.
> - * If we are looking for complete entries, show only those.
> - */
> - if (!!(args->op_flags & XFS_DA_OP_INCOMPLETE) !=
> - !!(entry->flags & XFS_ATTR_INCOMPLETE)) {
> - continue;
> - }
> if (entry->flags & XFS_ATTR_LOCAL) {
> name_loc = xfs_attr3_leaf_name_local(leaf, probe);
> if (!xfs_attr_match(args, name_loc->namelen,
> diff --git a/fs/xfs/libxfs/xfs_types.h b/fs/xfs/libxfs/xfs_types.h
> index 1bf84488d34c..1aec335dac92 100644
> --- a/fs/xfs/libxfs/xfs_types.h
> +++ b/fs/xfs/libxfs/xfs_types.h
> @@ -225,7 +225,6 @@ typedef struct xfs_da_args {
> #define XFS_DA_OP_OKNOENT 0x0008 /* lookup/add op, ENOENT ok, else die */
> #define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found */
> #define XFS_DA_OP_NOTIME 0x0020 /* don't update inode timestamps */
> -#define XFS_DA_OP_INCOMPLETE 0x0040 /* lookup INCOMPLETE attr keys */
>
> #define XFS_DA_OP_FLAGS \
> { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
> @@ -233,8 +232,7 @@ typedef struct xfs_da_args {
> { XFS_DA_OP_ADDNAME, "ADDNAME" }, \
> { XFS_DA_OP_OKNOENT, "OKNOENT" }, \
> { XFS_DA_OP_CILOOKUP, "CILOOKUP" }, \
> - { XFS_DA_OP_NOTIME, "NOTIME" }, \
> - { XFS_DA_OP_INCOMPLETE, "INCOMPLETE" }
> + { XFS_DA_OP_NOTIME, "NOTIME" }
>
> /*
> * Type verifier functions
> --
> 2.24.1
>