[v7,02/19] xfs: Embed struct xfs_name in xfs_da_args
diff mbox series

Message ID 20200223020611.1802-3-allison.henderson@oracle.com
State New
Headers show
Series
  • xfs: Delayed Ready Attrs
Related show

Commit Message

Allison Collins Feb. 23, 2020, 2:05 a.m. UTC
This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
members.  This helps to clean up the xfs_da_args structure and make it more uniform
with the new xfs_name parameter being passed around.

Signed-off-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
 fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
 fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
 fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
 fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
 fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
 fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
 fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
 fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
 fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
 fs/xfs/scrub/attr.c             |  12 ++---
 fs/xfs/xfs_trace.h              |  20 ++++----
 12 files changed, 130 insertions(+), 123 deletions(-)

Comments

Amir Goldstein Feb. 23, 2020, 11:54 a.m. UTC | #1
On Sun, Feb 23, 2020 at 4:07 AM Allison Collins
<allison.henderson@oracle.com> wrote:
>
> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
> members.  This helps to clean up the xfs_da_args structure and make it more uniform
> with the new xfs_name parameter being passed around.
>
> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> Reviewed-by: Brian Foster <bfoster@redhat.com>
> ---
>  fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>  fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>  fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>  fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>  fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>  fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>  fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>  fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>  fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>  fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>  fs/xfs/scrub/attr.c             |  12 ++---
>  fs/xfs/xfs_trace.h              |  20 ++++----
>  12 files changed, 130 insertions(+), 123 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 6717f47..9acdb23 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>         args->geo = dp->i_mount->m_attr_geo;
>         args->whichfork = XFS_ATTR_FORK;
>         args->dp = dp;
> -       args->flags = flags;
> -       args->name = name->name;
> -       args->namelen = name->len;
> -       if (args->namelen >= MAXNAMELEN)
> +       memcpy(&args->name, name, sizeof(struct xfs_name));

Maybe xfs_name_copy and xfs_name_equal are in order?

>
> +       /* Use name now stored in args */
> +       name = &args.name;
> +

It seem that the context of these comments be clear in the future.

>         args.value = value;
>         args.valuelen = valuelen;
>         args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
> @@ -372,7 +374,7 @@ xfs_attr_set(
>          */
>         if (XFS_IFORK_Q(dp) == 0) {
>                 int sf_size = sizeof(xfs_attr_sf_hdr_t) +
> -                       XFS_ATTR_SF_ENTSIZE_BYNAME(args.namelen, valuelen);
> +                       XFS_ATTR_SF_ENTSIZE_BYNAME(name->len, valuelen);
>
>                 error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
>                 if (error)
> @@ -457,6 +459,9 @@ xfs_attr_remove(
>         if (error)
>                 return error;
>
> +       /* Use name now stored in args */
> +       name = &args.name;
> +
>         /*
>          * we have no control over the attribute names that userspace passes us
>          * to remove, so we have to allow the name lookup prior to attribute
> @@ -532,10 +537,10 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
>         trace_xfs_attr_sf_addname(args);
>
>         retval = xfs_attr_shortform_lookup(args);
> -       if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
> +       if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
>                 return retval;
>         } else if (retval == -EEXIST) {
> -               if (args->flags & ATTR_CREATE)
> +               if (args->name.type & ATTR_CREATE)
>                         return retval;
>                 retval = xfs_attr_shortform_remove(args);
>                 if (retval)
> @@ -545,15 +550,15 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
>                  * that the leaf format add routine won't trip over the attr
>                  * not being around.
>                  */
> -               args->flags &= ~ATTR_REPLACE;
> +               args->name.type &= ~ATTR_REPLACE;


This doesn't look good it looks like a hack.

Even if want to avoid growing struct xfs_name we can store two shorts instead
of overloading int type with flags.
type doesn't even need more than a single byte, because XFS_DIR3_FT_WHT
is not used and will never be used on-disk.

Thanks,
Amir.
Allison Collins Feb. 23, 2020, 4:51 p.m. UTC | #2
On 2/23/20 4:54 AM, Amir Goldstein wrote:
> On Sun, Feb 23, 2020 at 4:07 AM Allison Collins
> <allison.henderson@oracle.com> wrote:
>>
>> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
>> members.  This helps to clean up the xfs_da_args structure and make it more uniform
>> with the new xfs_name parameter being passed around.
>>
>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>> Reviewed-by: Brian Foster <bfoster@redhat.com>
>> ---
>>   fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>>   fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>>   fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>>   fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>>   fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>>   fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>>   fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>>   fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>>   fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>>   fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>>   fs/xfs/scrub/attr.c             |  12 ++---
>>   fs/xfs/xfs_trace.h              |  20 ++++----
>>   12 files changed, 130 insertions(+), 123 deletions(-)
>>
>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
>> index 6717f47..9acdb23 100644
>> --- a/fs/xfs/libxfs/xfs_attr.c
>> +++ b/fs/xfs/libxfs/xfs_attr.c
>> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>>          args->geo = dp->i_mount->m_attr_geo;
>>          args->whichfork = XFS_ATTR_FORK;
>>          args->dp = dp;
>> -       args->flags = flags;
>> -       args->name = name->name;
>> -       args->namelen = name->len;
>> -       if (args->namelen >= MAXNAMELEN)
>> +       memcpy(&args->name, name, sizeof(struct xfs_name));
> 
> Maybe xfs_name_copy and xfs_name_equal are in order?
You are suggesting to add xfs_name_copy and xfs_name_equal helpers?  I'm 
not sure there's a use case yet for xfs_name_equal, at least not in this 
set.  And I think people indicated that they preferred the memcpy in 
past reviews rather than handling each member of the xfs_name struct. 
Unless I misunderstood the question, I'm not sure there is much left for 
a xfs_name_copy helper to cover that the memcpy does not?

> 
>>
>> +       /* Use name now stored in args */
>> +       name = &args.name;
>> +
> 
> It seem that the context of these comments be clear in the future.
You are asking to add more context to the comment?  How about:
	/*
	 * Use name now stored in args.  Abandon the local name 	
	 * parameter as it will not be updated in the subroutines
	 */

Does that help some?

> 
>>          args.value = value;
>>          args.valuelen = valuelen;
>>          args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
>> @@ -372,7 +374,7 @@ xfs_attr_set(
>>           */
>>          if (XFS_IFORK_Q(dp) == 0) {
>>                  int sf_size = sizeof(xfs_attr_sf_hdr_t) +
>> -                       XFS_ATTR_SF_ENTSIZE_BYNAME(args.namelen, valuelen);
>> +                       XFS_ATTR_SF_ENTSIZE_BYNAME(name->len, valuelen);
>>
>>                  error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
>>                  if (error)
>> @@ -457,6 +459,9 @@ xfs_attr_remove(
>>          if (error)
>>                  return error;
>>
>> +       /* Use name now stored in args */
>> +       name = &args.name;
>> +
>>          /*
>>           * we have no control over the attribute names that userspace passes us
>>           * to remove, so we have to allow the name lookup prior to attribute
>> @@ -532,10 +537,10 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
>>          trace_xfs_attr_sf_addname(args);
>>
>>          retval = xfs_attr_shortform_lookup(args);
>> -       if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
>> +       if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
>>                  return retval;
>>          } else if (retval == -EEXIST) {
>> -               if (args->flags & ATTR_CREATE)
>> +               if (args->name.type & ATTR_CREATE)
>>                          return retval;
>>                  retval = xfs_attr_shortform_remove(args);
>>                  if (retval)
>> @@ -545,15 +550,15 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
>>                   * that the leaf format add routine won't trip over the attr
>>                   * not being around.
>>                   */
>> -               args->flags &= ~ATTR_REPLACE;
>> +               args->name.type &= ~ATTR_REPLACE;
> 
> 
> This doesn't look good it looks like a hack.
> 
> Even if want to avoid growing struct xfs_name we can store two shorts instead
> of overloading int type with flags.
> type doesn't even need more than a single byte, because XFS_DIR3_FT_WHT
> is not used and will never be used on-disk.
> 
> Thanks,
> Amir.
> 
The exact use of .type has gone around a few times since this patch 
started, which was actually all the way back in parent pointers.  :-) 
Initially the xfs_name struct replaced anything that passed all three 
parameters, and then later we decided that flags should stay separate 
for top level get/set/remove routines, but become integrated below the 
*_args routines.  I don't recall people being concerned about growing 
the struct, though a union seems reasonable to resolve the naming 
weirdness.  I would like to have a little more feedback from folks 
though just to make sure everyones in agreement since this one's gone 
through quite few reviews already. Thanks all!

Allison
Amir Goldstein Feb. 24, 2020, 6:50 a.m. UTC | #3
On Sun, Feb 23, 2020 at 6:51 PM Allison Collins
<allison.henderson@oracle.com> wrote:
>
>
>
> On 2/23/20 4:54 AM, Amir Goldstein wrote:
> > On Sun, Feb 23, 2020 at 4:07 AM Allison Collins
> > <allison.henderson@oracle.com> wrote:
> >>
> >> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
> >> members.  This helps to clean up the xfs_da_args structure and make it more uniform
> >> with the new xfs_name parameter being passed around.
> >>
> >> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> >> Reviewed-by: Brian Foster <bfoster@redhat.com>
> >> ---
> >>   fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
> >>   fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
> >>   fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
> >>   fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
> >>   fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
> >>   fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
> >>   fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
> >>   fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
> >>   fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
> >>   fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
> >>   fs/xfs/scrub/attr.c             |  12 ++---
> >>   fs/xfs/xfs_trace.h              |  20 ++++----
> >>   12 files changed, 130 insertions(+), 123 deletions(-)
> >>
> >> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> >> index 6717f47..9acdb23 100644
> >> --- a/fs/xfs/libxfs/xfs_attr.c
> >> +++ b/fs/xfs/libxfs/xfs_attr.c
> >> @@ -72,13 +72,12 @@ xfs_attr_args_init(
> >>          args->geo = dp->i_mount->m_attr_geo;
> >>          args->whichfork = XFS_ATTR_FORK;
> >>          args->dp = dp;
> >> -       args->flags = flags;
> >> -       args->name = name->name;
> >> -       args->namelen = name->len;
> >> -       if (args->namelen >= MAXNAMELEN)
> >> +       memcpy(&args->name, name, sizeof(struct xfs_name));
> >
> > Maybe xfs_name_copy and xfs_name_equal are in order?
> You are suggesting to add xfs_name_copy and xfs_name_equal helpers?  I'm
> not sure there's a use case yet for xfs_name_equal, at least not in this
> set.  And I think people indicated that they preferred the memcpy in
> past reviews rather than handling each member of the xfs_name struct.
> Unless I misunderstood the question, I'm not sure there is much left for
> a xfs_name_copy helper to cover that the memcpy does not?
>

It's fine. The choice between xfs_name_copy and memcpy is
mostly personal taste. I did not read through past reviews.

> >
> >>
> >> +       /* Use name now stored in args */
> >> +       name = &args.name;
> >> +
> >
> > It seem that the context of these comments be clear in the future.
> You are asking to add more context to the comment?  How about:
>         /*
>          * Use name now stored in args.  Abandon the local name
>          * parameter as it will not be updated in the subroutines
>          */
>
> Does that help some?

Can't you just not use local name arg anymore?
Instead of re-assigning it and explaining why you do that.
Does that gain anything to code readability or anything else?

Thanks,
Amir.
Allison Collins Feb. 24, 2020, 7:36 a.m. UTC | #4
On 2/23/20 11:50 PM, Amir Goldstein wrote:
> On Sun, Feb 23, 2020 at 6:51 PM Allison Collins
> <allison.henderson@oracle.com> wrote:
>>
>>
>>
>> On 2/23/20 4:54 AM, Amir Goldstein wrote:
>>> On Sun, Feb 23, 2020 at 4:07 AM Allison Collins
>>> <allison.henderson@oracle.com> wrote:
>>>>
>>>> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
>>>> members.  This helps to clean up the xfs_da_args structure and make it more uniform
>>>> with the new xfs_name parameter being passed around.
>>>>
>>>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>>>> Reviewed-by: Brian Foster <bfoster@redhat.com>
>>>> ---
>>>>    fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>>>>    fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>>>>    fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>>>>    fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>>>>    fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>>>>    fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>>>>    fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>>>>    fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>>>>    fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>>>>    fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>>>>    fs/xfs/scrub/attr.c             |  12 ++---
>>>>    fs/xfs/xfs_trace.h              |  20 ++++----
>>>>    12 files changed, 130 insertions(+), 123 deletions(-)
>>>>
>>>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
>>>> index 6717f47..9acdb23 100644
>>>> --- a/fs/xfs/libxfs/xfs_attr.c
>>>> +++ b/fs/xfs/libxfs/xfs_attr.c
>>>> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>>>>           args->geo = dp->i_mount->m_attr_geo;
>>>>           args->whichfork = XFS_ATTR_FORK;
>>>>           args->dp = dp;
>>>> -       args->flags = flags;
>>>> -       args->name = name->name;
>>>> -       args->namelen = name->len;
>>>> -       if (args->namelen >= MAXNAMELEN)
>>>> +       memcpy(&args->name, name, sizeof(struct xfs_name));
>>>
>>> Maybe xfs_name_copy and xfs_name_equal are in order?
>> You are suggesting to add xfs_name_copy and xfs_name_equal helpers?  I'm
>> not sure there's a use case yet for xfs_name_equal, at least not in this
>> set.  And I think people indicated that they preferred the memcpy in
>> past reviews rather than handling each member of the xfs_name struct.
>> Unless I misunderstood the question, I'm not sure there is much left for
>> a xfs_name_copy helper to cover that the memcpy does not?
>>
> 
> It's fine. The choice between xfs_name_copy and memcpy is
> mostly personal taste. I did not read through past reviews.
> 
>>>
>>>>
>>>> +       /* Use name now stored in args */
>>>> +       name = &args.name;
>>>> +
>>>
>>> It seem that the context of these comments be clear in the future.
>> You are asking to add more context to the comment?  How about:
>>          /*
>>           * Use name now stored in args.  Abandon the local name
>>           * parameter as it will not be updated in the subroutines
>>           */
>>
>> Does that help some?
> 
> Can't you just not use local name arg anymore?
> Instead of re-assigning it and explaining why you do that.
> Does that gain anything to code readability or anything else?
Well, with out the set, you cannot use for example name->type anymore, 
you need to use args->name->type.  In order to use the local name 
variable again, it needs to be updated.  I stumbled across this myself 
when working with it and thought it would be better to fix it right away 
rather than let others run across the same mistake.  It seems like a 
subtle and easy thing to overlook otherwise.

I do think it's a bit of a wart that people may not have thought about 
when we talked about adding this patch.  Though I don't know that it's a 
big enough deal to drop it either.  But I did feel some motivation to at 
least clean it up and make a comment about it.

Allison

> 
> Thanks,
> Amir.
>
Amir Goldstein Feb. 24, 2020, 7:43 a.m. UTC | #5
On Mon, Feb 24, 2020 at 9:37 AM Allison Collins
<allison.henderson@oracle.com> wrote:
>
>
>
> On 2/23/20 11:50 PM, Amir Goldstein wrote:
> > On Sun, Feb 23, 2020 at 6:51 PM Allison Collins
> > <allison.henderson@oracle.com> wrote:
> >>
> >>
> >>
> >> On 2/23/20 4:54 AM, Amir Goldstein wrote:
> >>> On Sun, Feb 23, 2020 at 4:07 AM Allison Collins
> >>> <allison.henderson@oracle.com> wrote:
> >>>>
> >>>> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
> >>>> members.  This helps to clean up the xfs_da_args structure and make it more uniform
> >>>> with the new xfs_name parameter being passed around.
> >>>>
> >>>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> >>>> Reviewed-by: Brian Foster <bfoster@redhat.com>
> >>>> ---
> >>>>    fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
> >>>>    fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
> >>>>    fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
> >>>>    fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
> >>>>    fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
> >>>>    fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
> >>>>    fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
> >>>>    fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
> >>>>    fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
> >>>>    fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
> >>>>    fs/xfs/scrub/attr.c             |  12 ++---
> >>>>    fs/xfs/xfs_trace.h              |  20 ++++----
> >>>>    12 files changed, 130 insertions(+), 123 deletions(-)
> >>>>
> >>>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> >>>> index 6717f47..9acdb23 100644
> >>>> --- a/fs/xfs/libxfs/xfs_attr.c
> >>>> +++ b/fs/xfs/libxfs/xfs_attr.c
> >>>> @@ -72,13 +72,12 @@ xfs_attr_args_init(
> >>>>           args->geo = dp->i_mount->m_attr_geo;
> >>>>           args->whichfork = XFS_ATTR_FORK;
> >>>>           args->dp = dp;
> >>>> -       args->flags = flags;
> >>>> -       args->name = name->name;
> >>>> -       args->namelen = name->len;
> >>>> -       if (args->namelen >= MAXNAMELEN)
> >>>> +       memcpy(&args->name, name, sizeof(struct xfs_name));
> >>>
> >>> Maybe xfs_name_copy and xfs_name_equal are in order?
> >> You are suggesting to add xfs_name_copy and xfs_name_equal helpers?  I'm
> >> not sure there's a use case yet for xfs_name_equal, at least not in this
> >> set.  And I think people indicated that they preferred the memcpy in
> >> past reviews rather than handling each member of the xfs_name struct.
> >> Unless I misunderstood the question, I'm not sure there is much left for
> >> a xfs_name_copy helper to cover that the memcpy does not?
> >>
> >
> > It's fine. The choice between xfs_name_copy and memcpy is
> > mostly personal taste. I did not read through past reviews.
> >
> >>>
> >>>>
> >>>> +       /* Use name now stored in args */
> >>>> +       name = &args.name;
> >>>> +
> >>>
> >>> It seem that the context of these comments be clear in the future.
> >> You are asking to add more context to the comment?  How about:
> >>          /*
> >>           * Use name now stored in args.  Abandon the local name
> >>           * parameter as it will not be updated in the subroutines
> >>           */
> >>
> >> Does that help some?
> >
> > Can't you just not use local name arg anymore?
> > Instead of re-assigning it and explaining why you do that.
> > Does that gain anything to code readability or anything else?
> Well, with out the set, you cannot use for example name->type anymore,
> you need to use args->name->type.  In order to use the local name
> variable again, it needs to be updated.  I stumbled across this myself
> when working with it and thought it would be better to fix it right away
> rather than let others run across the same mistake.  It seems like a
> subtle and easy thing to overlook otherwise.
>
> I do think it's a bit of a wart that people may not have thought about
> when we talked about adding this patch.  Though I don't know that it's a
> big enough deal to drop it either.  But I did feel some motivation to at
> least clean it up and make a comment about it.
>

Understood. I have no smart suggestion, so withdrawing my comment.

Thanks,
Amir.
Dave Chinner Feb. 25, 2020, 12:57 a.m. UTC | #6
On Sat, Feb 22, 2020 at 07:05:54PM -0700, Allison Collins wrote:
> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
> members.  This helps to clean up the xfs_da_args structure and make it more uniform
> with the new xfs_name parameter being passed around.

Commit message should wrap at 68-72 columns.

> 
> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> Reviewed-by: Brian Foster <bfoster@redhat.com>
> ---
>  fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>  fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>  fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>  fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>  fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>  fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>  fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>  fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>  fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>  fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>  fs/xfs/scrub/attr.c             |  12 ++---
>  fs/xfs/xfs_trace.h              |  20 ++++----
>  12 files changed, 130 insertions(+), 123 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 6717f47..9acdb23 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>  	args->geo = dp->i_mount->m_attr_geo;
>  	args->whichfork = XFS_ATTR_FORK;
>  	args->dp = dp;
> -	args->flags = flags;
> -	args->name = name->name;
> -	args->namelen = name->len;
> -	if (args->namelen >= MAXNAMELEN)
> +	memcpy(&args->name, name, sizeof(struct xfs_name));
> +	args->name.type = flags;

This doesn't play well with Christoph's cleanup series which fixes
up all the confusion with internal versus API flags. I guess the
namespace is part of the attribute name, but I think this would be a
much clearer conversion when placed on top of the way Christoph
cleaned all this up...

Have you looked at rebasing this on top of that cleanup series?

Cheers,
Allison Collins Feb. 25, 2020, 2 a.m. UTC | #7
On 2/24/20 5:57 PM, Dave Chinner wrote:
> On Sat, Feb 22, 2020 at 07:05:54PM -0700, Allison Collins wrote:
>> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
>> members.  This helps to clean up the xfs_da_args structure and make it more uniform
>> with the new xfs_name parameter being passed around.
> 
> Commit message should wrap at 68-72 columns.
> 
>>
>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>> Reviewed-by: Brian Foster <bfoster@redhat.com>
>> ---
>>   fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>>   fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>>   fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>>   fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>>   fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>>   fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>>   fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>>   fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>>   fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>>   fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>>   fs/xfs/scrub/attr.c             |  12 ++---
>>   fs/xfs/xfs_trace.h              |  20 ++++----
>>   12 files changed, 130 insertions(+), 123 deletions(-)
>>
>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
>> index 6717f47..9acdb23 100644
>> --- a/fs/xfs/libxfs/xfs_attr.c
>> +++ b/fs/xfs/libxfs/xfs_attr.c
>> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>>   	args->geo = dp->i_mount->m_attr_geo;
>>   	args->whichfork = XFS_ATTR_FORK;
>>   	args->dp = dp;
>> -	args->flags = flags;
>> -	args->name = name->name;
>> -	args->namelen = name->len;
>> -	if (args->namelen >= MAXNAMELEN)
>> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>> +	args->name.type = flags;
> 
> This doesn't play well with Christoph's cleanup series which fixes
> up all the confusion with internal versus API flags. I guess the
> namespace is part of the attribute name, but I think this would be a
> much clearer conversion when placed on top of the way Christoph
> cleaned all this up...
> 
> Have you looked at rebasing this on top of that cleanup series?
> 
> Cheers,
> 
Yes, there is some conflict between the sets here and there, but I think 
folks wanted to keep them separate for now.  Are you referring to 
"[780d29057781] xfs: fix misuse of the XFS_ATTR_INCOMPLETE flag"?  I'm 
pretty sure this set is already seated on top of that one.  This one is 
based on the latest for-next.

Allison
Dave Chinner Feb. 25, 2020, 4:06 a.m. UTC | #8
On Mon, Feb 24, 2020 at 07:00:35PM -0700, Allison Collins wrote:
> 
> 
> On 2/24/20 5:57 PM, Dave Chinner wrote:
> > On Sat, Feb 22, 2020 at 07:05:54PM -0700, Allison Collins wrote:
> > > This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
> > > members.  This helps to clean up the xfs_da_args structure and make it more uniform
> > > with the new xfs_name parameter being passed around.
> > 
> > Commit message should wrap at 68-72 columns.
> > 
> > > 
> > > Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> > > Reviewed-by: Brian Foster <bfoster@redhat.com>
> > > ---
> > >   fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
> > >   fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
> > >   fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
> > >   fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
> > >   fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
> > >   fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
> > >   fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
> > >   fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
> > >   fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
> > >   fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
> > >   fs/xfs/scrub/attr.c             |  12 ++---
> > >   fs/xfs/xfs_trace.h              |  20 ++++----
> > >   12 files changed, 130 insertions(+), 123 deletions(-)
> > > 
> > > diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> > > index 6717f47..9acdb23 100644
> > > --- a/fs/xfs/libxfs/xfs_attr.c
> > > +++ b/fs/xfs/libxfs/xfs_attr.c
> > > @@ -72,13 +72,12 @@ xfs_attr_args_init(
> > >   	args->geo = dp->i_mount->m_attr_geo;
> > >   	args->whichfork = XFS_ATTR_FORK;
> > >   	args->dp = dp;
> > > -	args->flags = flags;
> > > -	args->name = name->name;
> > > -	args->namelen = name->len;
> > > -	if (args->namelen >= MAXNAMELEN)
> > > +	memcpy(&args->name, name, sizeof(struct xfs_name));
> > > +	args->name.type = flags;
> > 
> > This doesn't play well with Christoph's cleanup series which fixes
> > up all the confusion with internal versus API flags. I guess the
> > namespace is part of the attribute name, but I think this would be a
> > much clearer conversion when placed on top of the way Christoph
> > cleaned all this up...
> > 
> > Have you looked at rebasing this on top of that cleanup series?
> > 
> > Cheers,
> > 
> Yes, there is some conflict between the sets here and there, but I think
> folks wanted to keep them separate for now.

That makes it really hard to form a clear view of what the code
looks like after both patchsets have been applied. :(

> Are you referring to
> "[780d29057781] xfs: fix misuse of the XFS_ATTR_INCOMPLETE flag"?  I'm
> pretty sure this set is already seated on top of that one.  This one is
> based on the latest for-next.

No, I'm talking about the series that ends up undoing that commit
(i.e. the DA_OP_INCOMPLETE flag goes away again) and turns
args->flags into args->attr_filter as the namespace filter for
lookups. THis also turn adds XFS_ATTR_INCOMPLETE into a lookup
filter.

With this separation of ops vs lookup filters, moving the lookup
filter into the xfs_name makes a bit more sense (i.e. the namespace
filter is passed with the attribute name), but as a standalone
movement it creates a bit of an impedence mismatch between the xname
and the use of these flags.

I think the end result will be fine, but it's making it hard for me
to reconcile the changes in the two patchsets...

Cheers,

Dave.
Allison Collins Feb. 25, 2020, 4:19 a.m. UTC | #9
On 2/24/20 9:06 PM, Dave Chinner wrote:
> On Mon, Feb 24, 2020 at 07:00:35PM -0700, Allison Collins wrote:
>>
>>
>> On 2/24/20 5:57 PM, Dave Chinner wrote:
>>> On Sat, Feb 22, 2020 at 07:05:54PM -0700, Allison Collins wrote:
>>>> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
>>>> members.  This helps to clean up the xfs_da_args structure and make it more uniform
>>>> with the new xfs_name parameter being passed around.
>>>
>>> Commit message should wrap at 68-72 columns.
>>>
>>>>
>>>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>>>> Reviewed-by: Brian Foster <bfoster@redhat.com>
>>>> ---
>>>>    fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>>>>    fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>>>>    fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>>>>    fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>>>>    fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>>>>    fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>>>>    fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>>>>    fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>>>>    fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>>>>    fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>>>>    fs/xfs/scrub/attr.c             |  12 ++---
>>>>    fs/xfs/xfs_trace.h              |  20 ++++----
>>>>    12 files changed, 130 insertions(+), 123 deletions(-)
>>>>
>>>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
>>>> index 6717f47..9acdb23 100644
>>>> --- a/fs/xfs/libxfs/xfs_attr.c
>>>> +++ b/fs/xfs/libxfs/xfs_attr.c
>>>> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>>>>    	args->geo = dp->i_mount->m_attr_geo;
>>>>    	args->whichfork = XFS_ATTR_FORK;
>>>>    	args->dp = dp;
>>>> -	args->flags = flags;
>>>> -	args->name = name->name;
>>>> -	args->namelen = name->len;
>>>> -	if (args->namelen >= MAXNAMELEN)
>>>> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>>>> +	args->name.type = flags;
>>>
>>> This doesn't play well with Christoph's cleanup series which fixes
>>> up all the confusion with internal versus API flags. I guess the
>>> namespace is part of the attribute name, but I think this would be a
>>> much clearer conversion when placed on top of the way Christoph
>>> cleaned all this up...
>>>
>>> Have you looked at rebasing this on top of that cleanup series?
>>>
>>> Cheers,
>>>
>> Yes, there is some conflict between the sets here and there, but I think
>> folks wanted to keep them separate for now.
> 
> That makes it really hard to form a clear view of what the code
> looks like after both patchsets have been applied. :(
> 
>> Are you referring to
>> "[780d29057781] xfs: fix misuse of the XFS_ATTR_INCOMPLETE flag"?  I'm
>> pretty sure this set is already seated on top of that one.  This one is
>> based on the latest for-next.
> 
> No, I'm talking about the series that ends up undoing that commit
> (i.e. the DA_OP_INCOMPLETE flag goes away again) and turns
> args->flags into args->attr_filter as the namespace filter for
> lookups. THis also turn adds XFS_ATTR_INCOMPLETE into a lookup
> filter.
> 
> With this separation of ops vs lookup filters, moving the lookup
> filter into the xfs_name makes a bit more sense (i.e. the namespace
> filter is passed with the attribute name), but as a standalone
> movement it creates a bit of an impedence mismatch between the xname
> and the use of these flags.
> 
> I think the end result will be fine, but it's making it hard for me
> to reconcile the changes in the two patchsets...
> 
> Cheers,

I'd be happy to go through the sets and find the intersections. Or make 
a big super set if you like.  I got the impression though that Christoph 
didnt particularly like the delayed attr series or the idea of blending 
them.  But I do think it would be a good idea to take into consideration 
what the combination of them is going to look like.

Allison

> 
> Dave.
>
Darrick J. Wong Feb. 25, 2020, 4:27 a.m. UTC | #10
On Mon, Feb 24, 2020 at 09:19:58PM -0700, Allison Collins wrote:
> 
> 
> On 2/24/20 9:06 PM, Dave Chinner wrote:
> > On Mon, Feb 24, 2020 at 07:00:35PM -0700, Allison Collins wrote:
> > > 
> > > 
> > > On 2/24/20 5:57 PM, Dave Chinner wrote:
> > > > On Sat, Feb 22, 2020 at 07:05:54PM -0700, Allison Collins wrote:
> > > > > This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
> > > > > members.  This helps to clean up the xfs_da_args structure and make it more uniform
> > > > > with the new xfs_name parameter being passed around.
> > > > 
> > > > Commit message should wrap at 68-72 columns.
> > > > 
> > > > > 
> > > > > Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> > > > > Reviewed-by: Brian Foster <bfoster@redhat.com>
> > > > > ---
> > > > >    fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
> > > > >    fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
> > > > >    fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
> > > > >    fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
> > > > >    fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
> > > > >    fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
> > > > >    fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
> > > > >    fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
> > > > >    fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
> > > > >    fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
> > > > >    fs/xfs/scrub/attr.c             |  12 ++---
> > > > >    fs/xfs/xfs_trace.h              |  20 ++++----
> > > > >    12 files changed, 130 insertions(+), 123 deletions(-)
> > > > > 
> > > > > diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> > > > > index 6717f47..9acdb23 100644
> > > > > --- a/fs/xfs/libxfs/xfs_attr.c
> > > > > +++ b/fs/xfs/libxfs/xfs_attr.c
> > > > > @@ -72,13 +72,12 @@ xfs_attr_args_init(
> > > > >    	args->geo = dp->i_mount->m_attr_geo;
> > > > >    	args->whichfork = XFS_ATTR_FORK;
> > > > >    	args->dp = dp;
> > > > > -	args->flags = flags;
> > > > > -	args->name = name->name;
> > > > > -	args->namelen = name->len;
> > > > > -	if (args->namelen >= MAXNAMELEN)
> > > > > +	memcpy(&args->name, name, sizeof(struct xfs_name));
> > > > > +	args->name.type = flags;
> > > > 
> > > > This doesn't play well with Christoph's cleanup series which fixes
> > > > up all the confusion with internal versus API flags. I guess the
> > > > namespace is part of the attribute name, but I think this would be a
> > > > much clearer conversion when placed on top of the way Christoph
> > > > cleaned all this up...
> > > > 
> > > > Have you looked at rebasing this on top of that cleanup series?
> > > > 
> > > > Cheers,
> > > > 
> > > Yes, there is some conflict between the sets here and there, but I think
> > > folks wanted to keep them separate for now.
> > 
> > That makes it really hard to form a clear view of what the code
> > looks like after both patchsets have been applied. :(
> > 
> > > Are you referring to
> > > "[780d29057781] xfs: fix misuse of the XFS_ATTR_INCOMPLETE flag"?  I'm
> > > pretty sure this set is already seated on top of that one.  This one is
> > > based on the latest for-next.
> > 
> > No, I'm talking about the series that ends up undoing that commit
> > (i.e. the DA_OP_INCOMPLETE flag goes away again) and turns
> > args->flags into args->attr_filter as the namespace filter for
> > lookups. THis also turn adds XFS_ATTR_INCOMPLETE into a lookup
> > filter.
> > 
> > With this separation of ops vs lookup filters, moving the lookup
> > filter into the xfs_name makes a bit more sense (i.e. the namespace
> > filter is passed with the attribute name), but as a standalone
> > movement it creates a bit of an impedence mismatch between the xname
> > and the use of these flags.
> > 
> > I think the end result will be fine, but it's making it hard for me
> > to reconcile the changes in the two patchsets...
> > 
> > Cheers,
> 
> I'd be happy to go through the sets and find the intersections. Or make a
> big super set if you like.  I got the impression though that Christoph didnt
> particularly like the delayed attr series or the idea of blending them.  But
> I do think it would be a good idea to take into consideration what the
> combination of them is going to look like.

At this point you might as well wait for me to actually put hch's attr
interface refactoring series into for-next (unless this series is
already based off of that??) though Christoph might be a bit time
constrained this week...

--D

> Allison
> 
> > 
> > Dave.
> > 
> 
>
Allison Collins Feb. 25, 2020, 6:07 a.m. UTC | #11
On 2/24/20 9:27 PM, Darrick J. Wong wrote:
> On Mon, Feb 24, 2020 at 09:19:58PM -0700, Allison Collins wrote:
>>
>>
>> On 2/24/20 9:06 PM, Dave Chinner wrote:
>>> On Mon, Feb 24, 2020 at 07:00:35PM -0700, Allison Collins wrote:
>>>>
>>>>
>>>> On 2/24/20 5:57 PM, Dave Chinner wrote:
>>>>> On Sat, Feb 22, 2020 at 07:05:54PM -0700, Allison Collins wrote:
>>>>>> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
>>>>>> members.  This helps to clean up the xfs_da_args structure and make it more uniform
>>>>>> with the new xfs_name parameter being passed around.
>>>>>
>>>>> Commit message should wrap at 68-72 columns.
>>>>>
>>>>>>
>>>>>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>>>>>> Reviewed-by: Brian Foster <bfoster@redhat.com>
>>>>>> ---
>>>>>>     fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>>>>>>     fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>>>>>>     fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>>>>>>     fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>>>>>>     fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>>>>>>     fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>>>>>>     fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>>>>>>     fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>>>>>>     fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>>>>>>     fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>>>>>>     fs/xfs/scrub/attr.c             |  12 ++---
>>>>>>     fs/xfs/xfs_trace.h              |  20 ++++----
>>>>>>     12 files changed, 130 insertions(+), 123 deletions(-)
>>>>>>
>>>>>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
>>>>>> index 6717f47..9acdb23 100644
>>>>>> --- a/fs/xfs/libxfs/xfs_attr.c
>>>>>> +++ b/fs/xfs/libxfs/xfs_attr.c
>>>>>> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>>>>>>     	args->geo = dp->i_mount->m_attr_geo;
>>>>>>     	args->whichfork = XFS_ATTR_FORK;
>>>>>>     	args->dp = dp;
>>>>>> -	args->flags = flags;
>>>>>> -	args->name = name->name;
>>>>>> -	args->namelen = name->len;
>>>>>> -	if (args->namelen >= MAXNAMELEN)
>>>>>> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>>>>>> +	args->name.type = flags;
>>>>>
>>>>> This doesn't play well with Christoph's cleanup series which fixes
>>>>> up all the confusion with internal versus API flags. I guess the
>>>>> namespace is part of the attribute name, but I think this would be a
>>>>> much clearer conversion when placed on top of the way Christoph
>>>>> cleaned all this up...
>>>>>
>>>>> Have you looked at rebasing this on top of that cleanup series?
>>>>>
>>>>> Cheers,
>>>>>
>>>> Yes, there is some conflict between the sets here and there, but I think
>>>> folks wanted to keep them separate for now.
>>>
>>> That makes it really hard to form a clear view of what the code
>>> looks like after both patchsets have been applied. :(
>>>
>>>> Are you referring to
>>>> "[780d29057781] xfs: fix misuse of the XFS_ATTR_INCOMPLETE flag"?  I'm
>>>> pretty sure this set is already seated on top of that one.  This one is
>>>> based on the latest for-next.
>>>
>>> No, I'm talking about the series that ends up undoing that commit
>>> (i.e. the DA_OP_INCOMPLETE flag goes away again) and turns
>>> args->flags into args->attr_filter as the namespace filter for
>>> lookups. THis also turn adds XFS_ATTR_INCOMPLETE into a lookup
>>> filter.
>>>
>>> With this separation of ops vs lookup filters, moving the lookup
>>> filter into the xfs_name makes a bit more sense (i.e. the namespace
>>> filter is passed with the attribute name), but as a standalone
>>> movement it creates a bit of an impedence mismatch between the xname
>>> and the use of these flags.
>>>
>>> I think the end result will be fine, but it's making it hard for me
>>> to reconcile the changes in the two patchsets...
>>>
>>> Cheers,
>>
>> I'd be happy to go through the sets and find the intersections. Or make a
>> big super set if you like.  I got the impression though that Christoph didnt
>> particularly like the delayed attr series or the idea of blending them.  But
>> I do think it would be a good idea to take into consideration what the
>> combination of them is going to look like.
> 
> At this point you might as well wait for me to actually put hch's attr
> interface refactoring series into for-next (unless this series is
> already based off of that??) though Christoph might be a bit time
> constrained this week...

It's based on for-next at this point.  Both these sets are pretty big, 
so it's a lot to chase if he's not interested in slowing down to work 
with the combination of them.  If folks would like to see the 
combination set before moving forward, I'd be happy to try and put that 
together.  Otherwise, it can wait too.  Let me know.  Thanks!

Allison

> 
> --D
> 
>> Allison
>>
>>>
>>> Dave.
>>>
>>
>>
Dave Chinner Feb. 25, 2020, 6:30 a.m. UTC | #12
On Mon, Feb 24, 2020 at 11:07:37PM -0700, Allison Collins wrote:
> It's based on for-next at this point.  Both these sets are pretty big, so
> it's a lot to chase if he's not interested in slowing down to work with the
> combination of them.  If folks would like to see the combination set before
> moving forward, I'd be happy to try and put that together.  Otherwise, it
> can wait too.  Let me know.  Thanks!

I'd simply rebase it on top of christoph's patchset based on the
fact it's likely to be merged before this one. Christoph posted a
git tree link, just pull that down and use that as the topic branch
you rebase onto....

Cheers,

Dave.
Chandan Rajendra Feb. 25, 2020, 6:56 a.m. UTC | #13
On Sunday, February 23, 2020 7:35 AM Allison Collins wrote: 
> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
> members.  This helps to clean up the xfs_da_args structure and make it more uniform
> with the new xfs_name parameter being passed around.
>

The statement "name = &args.name;" in xfs_attr_set() and xfs_attr_remove() was
not apparent to me on first read. However your explaination to Amir's question
about name.type being set in xfs_attr_args_init() made it clear.

Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>

> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> Reviewed-by: Brian Foster <bfoster@redhat.com>
> ---
>  fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>  fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>  fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>  fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>  fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>  fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>  fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>  fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>  fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>  fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>  fs/xfs/scrub/attr.c             |  12 ++---
>  fs/xfs/xfs_trace.h              |  20 ++++----
>  12 files changed, 130 insertions(+), 123 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 6717f47..9acdb23 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>  	args->geo = dp->i_mount->m_attr_geo;
>  	args->whichfork = XFS_ATTR_FORK;
>  	args->dp = dp;
> -	args->flags = flags;
> -	args->name = name->name;
> -	args->namelen = name->len;
> -	if (args->namelen >= MAXNAMELEN)
> +	memcpy(&args->name, name, sizeof(struct xfs_name));
> +	args->name.type = flags;
> +	if (args->name.len >= MAXNAMELEN)
>  		return -EFAULT;		/* match IRIX behaviour */
>  
> -	args->hashval = xfs_da_hashname(args->name, args->namelen);
> +	args->hashval = xfs_da_hashname(args->name.name, args->name.len);
>  	return 0;
>  }
>  
> @@ -236,7 +235,7 @@ xfs_attr_try_sf_addname(
>  	 * Commit the shortform mods, and we're done.
>  	 * NOTE: this is also the error path (EEXIST, etc).
>  	 */
> -	if (!error && (args->flags & ATTR_KERNOTIME) == 0)
> +	if (!error && (args->name.type & ATTR_KERNOTIME) == 0)
>  		xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
>  
>  	if (mp->m_flags & XFS_MOUNT_WSYNC)
> @@ -357,6 +356,9 @@ xfs_attr_set(
>  	if (error)
>  		return error;
>  
> +	/* Use name now stored in args */
> +	name = &args.name;
> +
>  	args.value = value;
>  	args.valuelen = valuelen;
>  	args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
> @@ -372,7 +374,7 @@ xfs_attr_set(
>  	 */
>  	if (XFS_IFORK_Q(dp) == 0) {
>  		int sf_size = sizeof(xfs_attr_sf_hdr_t) +
> -			XFS_ATTR_SF_ENTSIZE_BYNAME(args.namelen, valuelen);
> +			XFS_ATTR_SF_ENTSIZE_BYNAME(name->len, valuelen);
>  
>  		error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
>  		if (error)
> @@ -457,6 +459,9 @@ xfs_attr_remove(
>  	if (error)
>  		return error;
>  
> +	/* Use name now stored in args */
> +	name = &args.name;
> +
>  	/*
>  	 * we have no control over the attribute names that userspace passes us
>  	 * to remove, so we have to allow the name lookup prior to attribute
> @@ -532,10 +537,10 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
>  	trace_xfs_attr_sf_addname(args);
>  
>  	retval = xfs_attr_shortform_lookup(args);
> -	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
> +	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
>  		return retval;
>  	} else if (retval == -EEXIST) {
> -		if (args->flags & ATTR_CREATE)
> +		if (args->name.type & ATTR_CREATE)
>  			return retval;
>  		retval = xfs_attr_shortform_remove(args);
>  		if (retval)
> @@ -545,15 +550,15 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
>  		 * that the leaf format add routine won't trip over the attr
>  		 * not being around.
>  		 */
> -		args->flags &= ~ATTR_REPLACE;
> +		args->name.type &= ~ATTR_REPLACE;
>  	}
>  
> -	if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
> +	if (args->name.len >= XFS_ATTR_SF_ENTSIZE_MAX ||
>  	    args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX)
>  		return -ENOSPC;
>  
>  	newsize = XFS_ATTR_SF_TOTSIZE(args->dp);
> -	newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
> +	newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->name.len, args->valuelen);
>  
>  	forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize);
>  	if (!forkoff)
> @@ -598,11 +603,11 @@ xfs_attr_leaf_addname(
>  	 * the given flags produce an error or call for an atomic rename.
>  	 */
>  	retval = xfs_attr3_leaf_lookup_int(bp, args);
> -	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
> +	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
>  		xfs_trans_brelse(args->trans, bp);
>  		return retval;
>  	} else if (retval == -EEXIST) {
> -		if (args->flags & ATTR_CREATE) {	/* pure create op */
> +		if (args->name.type & ATTR_CREATE) {	/* pure create op */
>  			xfs_trans_brelse(args->trans, bp);
>  			return retval;
>  		}
> @@ -872,10 +877,10 @@ xfs_attr_node_addname(
>  		goto out;
>  	blk = &state->path.blk[ state->path.active-1 ];
>  	ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
> -	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
> +	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
>  		goto out;
>  	} else if (retval == -EEXIST) {
> -		if (args->flags & ATTR_CREATE)
> +		if (args->name.type & ATTR_CREATE)
>  			goto out;
>  
>  		trace_xfs_attr_node_replace(args);
> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
> index fed537a..cb5ef66 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
> @@ -464,7 +464,7 @@ xfs_attr_copy_value(
>  	/*
>  	 * No copy if all we have to do is get the length
>  	 */
> -	if (args->flags & ATTR_KERNOVAL) {
> +	if (args->name.type & ATTR_KERNOVAL) {
>  		args->valuelen = valuelen;
>  		return 0;
>  	}
> @@ -679,27 +679,27 @@ xfs_attr_shortform_add(xfs_da_args_t *args, int forkoff)
>  	sfe = &sf->list[0];
>  	for (i = 0; i < sf->hdr.count; sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
>  #ifdef DEBUG
> -		if (sfe->namelen != args->namelen)
> +		if (sfe->namelen != args->name.len)
>  			continue;
> -		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
> +		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
>  			continue;
> -		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
> +		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
>  			continue;
>  		ASSERT(0);
>  #endif
>  	}
>  
>  	offset = (char *)sfe - (char *)sf;
> -	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
> +	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->name.len, args->valuelen);
>  	xfs_idata_realloc(dp, size, XFS_ATTR_FORK);
>  	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
>  	sfe = (xfs_attr_sf_entry_t *)((char *)sf + offset);
>  
> -	sfe->namelen = args->namelen;
> +	sfe->namelen = args->name.len;
>  	sfe->valuelen = args->valuelen;
> -	sfe->flags = XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags);
> -	memcpy(sfe->nameval, args->name, args->namelen);
> -	memcpy(&sfe->nameval[args->namelen], args->value, args->valuelen);
> +	sfe->flags = XFS_ATTR_NSP_ARGS_TO_ONDISK(args->name.type);
> +	memcpy(sfe->nameval, args->name.name, args->name.len);
> +	memcpy(&sfe->nameval[args->name.len], args->value, args->valuelen);
>  	sf->hdr.count++;
>  	be16_add_cpu(&sf->hdr.totsize, size);
>  	xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
> @@ -749,11 +749,11 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
>  	for (i = 0; i < end; sfe = XFS_ATTR_SF_NEXTENTRY(sfe),
>  					base += size, i++) {
>  		size = XFS_ATTR_SF_ENTSIZE(sfe);
> -		if (sfe->namelen != args->namelen)
> +		if (sfe->namelen != args->name.len)
>  			continue;
> -		if (memcmp(sfe->nameval, args->name, args->namelen) != 0)
> +		if (memcmp(sfe->nameval, args->name.name, args->name.len) != 0)
>  			continue;
> -		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
> +		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
>  			continue;
>  		break;
>  	}
> @@ -816,11 +816,11 @@ xfs_attr_shortform_lookup(xfs_da_args_t *args)
>  	sfe = &sf->list[0];
>  	for (i = 0; i < sf->hdr.count;
>  				sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
> -		if (sfe->namelen != args->namelen)
> +		if (sfe->namelen != args->name.len)
>  			continue;
> -		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
> +		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
>  			continue;
> -		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
> +		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
>  			continue;
>  		return -EEXIST;
>  	}
> @@ -847,13 +847,13 @@ xfs_attr_shortform_getvalue(
>  	sfe = &sf->list[0];
>  	for (i = 0; i < sf->hdr.count;
>  				sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
> -		if (sfe->namelen != args->namelen)
> +		if (sfe->namelen != args->name.len)
>  			continue;
> -		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
> +		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
>  			continue;
> -		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
> +		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
>  			continue;
> -		return xfs_attr_copy_value(args, &sfe->nameval[args->namelen],
> +		return xfs_attr_copy_value(args, &sfe->nameval[args->name.len],
>  						sfe->valuelen);
>  	}
>  	return -ENOATTR;
> @@ -912,13 +912,13 @@ xfs_attr_shortform_to_leaf(
>  
>  	sfe = &sf->list[0];
>  	for (i = 0; i < sf->hdr.count; i++) {
> -		nargs.name = sfe->nameval;
> -		nargs.namelen = sfe->namelen;
> -		nargs.value = &sfe->nameval[nargs.namelen];
> +		nargs.name.name = sfe->nameval;
> +		nargs.name.len = sfe->namelen;
> +		nargs.value = &sfe->nameval[nargs.name.len];
>  		nargs.valuelen = sfe->valuelen;
>  		nargs.hashval = xfs_da_hashname(sfe->nameval,
>  						sfe->namelen);
> -		nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);
> +		nargs.name.type = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);
>  		error = xfs_attr3_leaf_lookup_int(bp, &nargs); /* set a->index */
>  		ASSERT(error == -ENOATTR);
>  		error = xfs_attr3_leaf_add(bp, &nargs);
> @@ -1119,12 +1119,12 @@ xfs_attr3_leaf_to_shortform(
>  			continue;
>  		ASSERT(entry->flags & XFS_ATTR_LOCAL);
>  		name_loc = xfs_attr3_leaf_name_local(leaf, i);
> -		nargs.name = name_loc->nameval;
> -		nargs.namelen = name_loc->namelen;
> -		nargs.value = &name_loc->nameval[nargs.namelen];
> +		nargs.name.name = name_loc->nameval;
> +		nargs.name.len = name_loc->namelen;
> +		nargs.value = &name_loc->nameval[nargs.name.len];
>  		nargs.valuelen = be16_to_cpu(name_loc->valuelen);
>  		nargs.hashval = be32_to_cpu(entry->hashval);
> -		nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
> +		nargs.name.type = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
>  		xfs_attr_shortform_add(&nargs, forkoff);
>  	}
>  	error = 0;
> @@ -1450,7 +1450,7 @@ xfs_attr3_leaf_add_work(
>  				     ichdr->freemap[mapindex].size);
>  	entry->hashval = cpu_to_be32(args->hashval);
>  	entry->flags = tmp ? XFS_ATTR_LOCAL : 0;
> -	entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags);
> +	entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->name.type);
>  	if (args->op_flags & XFS_DA_OP_RENAME) {
>  		entry->flags |= XFS_ATTR_INCOMPLETE;
>  		if ((args->blkno2 == args->blkno) &&
> @@ -1474,15 +1474,16 @@ xfs_attr3_leaf_add_work(
>  	 */
>  	if (entry->flags & XFS_ATTR_LOCAL) {
>  		name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
> -		name_loc->namelen = args->namelen;
> +		name_loc->namelen = args->name.len;
>  		name_loc->valuelen = cpu_to_be16(args->valuelen);
> -		memcpy((char *)name_loc->nameval, args->name, args->namelen);
> -		memcpy((char *)&name_loc->nameval[args->namelen], args->value,
> +		memcpy((char *)name_loc->nameval, args->name.name,
> +		       args->name.len);
> +		memcpy((char *)&name_loc->nameval[args->name.len], args->value,
>  				   be16_to_cpu(name_loc->valuelen));
>  	} else {
>  		name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
> -		name_rmt->namelen = args->namelen;
> -		memcpy((char *)name_rmt->name, args->name, args->namelen);
> +		name_rmt->namelen = args->name.len;
> +		memcpy((char *)name_rmt->name, args->name.name, args->name.len);
>  		entry->flags |= XFS_ATTR_INCOMPLETE;
>  		/* just in case */
>  		name_rmt->valuelen = 0;
> @@ -2409,23 +2410,25 @@ xfs_attr3_leaf_lookup_int(
>  		}
>  		if (entry->flags & XFS_ATTR_LOCAL) {
>  			name_loc = xfs_attr3_leaf_name_local(leaf, probe);
> -			if (name_loc->namelen != args->namelen)
> +			if (name_loc->namelen != args->name.len)
>  				continue;
> -			if (memcmp(args->name, name_loc->nameval,
> -							args->namelen) != 0)
> +			if (memcmp(args->name.name, name_loc->nameval,
> +							args->name.len) != 0)
>  				continue;
> -			if (!xfs_attr_namesp_match(args->flags, entry->flags))
> +			if (!xfs_attr_namesp_match(args->name.type,
> +						   entry->flags))
>  				continue;
>  			args->index = probe;
>  			return -EEXIST;
>  		} else {
>  			name_rmt = xfs_attr3_leaf_name_remote(leaf, probe);
> -			if (name_rmt->namelen != args->namelen)
> +			if (name_rmt->namelen != args->name.len)
>  				continue;
> -			if (memcmp(args->name, name_rmt->name,
> -							args->namelen) != 0)
> +			if (memcmp(args->name.name, name_rmt->name,
> +							args->name.len) != 0)
>  				continue;
> -			if (!xfs_attr_namesp_match(args->flags, entry->flags))
> +			if (!xfs_attr_namesp_match(args->name.type,
> +						   entry->flags))
>  				continue;
>  			args->index = probe;
>  			args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);
> @@ -2467,16 +2470,17 @@ xfs_attr3_leaf_getvalue(
>  	entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
>  	if (entry->flags & XFS_ATTR_LOCAL) {
>  		name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
> -		ASSERT(name_loc->namelen == args->namelen);
> -		ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0);
> +		ASSERT(name_loc->namelen == args->name.len);
> +		ASSERT(memcmp(args->name.name, name_loc->nameval,
> +			      args->name.len) == 0);
>  		return xfs_attr_copy_value(args,
> -					&name_loc->nameval[args->namelen],
> +					&name_loc->nameval[args->name.len],
>  					be16_to_cpu(name_loc->valuelen));
>  	}
>  
>  	name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
> -	ASSERT(name_rmt->namelen == args->namelen);
> -	ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0);
> +	ASSERT(name_rmt->namelen == args->name.len);
> +	ASSERT(memcmp(args->name.name, name_rmt->name, args->name.len) == 0);
>  	args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);
>  	args->rmtblkno = be32_to_cpu(name_rmt->valueblk);
>  	args->rmtblkcnt = xfs_attr3_rmt_blocks(args->dp->i_mount,
> @@ -2692,7 +2696,7 @@ xfs_attr_leaf_newentsize(
>  {
>  	int			size;
>  
> -	size = xfs_attr_leaf_entsize_local(args->namelen, args->valuelen);
> +	size = xfs_attr_leaf_entsize_local(args->name.len, args->valuelen);
>  	if (size < xfs_attr_leaf_entsize_local_max(args->geo->blksize)) {
>  		if (local)
>  			*local = 1;
> @@ -2700,7 +2704,7 @@ xfs_attr_leaf_newentsize(
>  	}
>  	if (local)
>  		*local = 0;
> -	return xfs_attr_leaf_entsize_remote(args->namelen);
> +	return xfs_attr_leaf_entsize_remote(args->name.len);
>  }
>  
>  
> @@ -2754,8 +2758,8 @@ xfs_attr3_leaf_clearflag(
>  		name = (char *)name_rmt->name;
>  	}
>  	ASSERT(be32_to_cpu(entry->hashval) == args->hashval);
> -	ASSERT(namelen == args->namelen);
> -	ASSERT(memcmp(name, args->name, namelen) == 0);
> +	ASSERT(namelen == args->name.len);
> +	ASSERT(memcmp(name, args->name.name, namelen) == 0);
>  #endif /* DEBUG */
>  
>  	entry->flags &= ~XFS_ATTR_INCOMPLETE;
> diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
> index 8b7f74b..df8aca5 100644
> --- a/fs/xfs/libxfs/xfs_attr_remote.c
> +++ b/fs/xfs/libxfs/xfs_attr_remote.c
> @@ -397,7 +397,7 @@ xfs_attr_rmtval_get(
>  
>  	trace_xfs_attr_rmtval_get(args);
>  
> -	ASSERT(!(args->flags & ATTR_KERNOVAL));
> +	ASSERT(!(args->name.type & ATTR_KERNOVAL));
>  	ASSERT(args->rmtvaluelen == args->valuelen);
>  
>  	valuelen = args->rmtvaluelen;
> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> index 875e04f..30f27d7 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.c
> +++ b/fs/xfs/libxfs/xfs_da_btree.c
> @@ -2125,8 +2125,10 @@ xfs_da_compname(
>  	const unsigned char *name,
>  	int		len)
>  {
> -	return (args->namelen == len && memcmp(args->name, name, len) == 0) ?
> -					XFS_CMP_EXACT : XFS_CMP_DIFFERENT;
> +	if (args->name.len == len && !memcmp(args->name.name, name, len))
> +		return XFS_CMP_EXACT;
> +
> +	return XFS_CMP_DIFFERENT;
>  }
>  
>  int
> diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h
> index 0f4fbb0..14f1be3 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.h
> +++ b/fs/xfs/libxfs/xfs_da_btree.h
> @@ -54,12 +54,10 @@ enum xfs_dacmp {
>   */
>  typedef struct xfs_da_args {
>  	struct xfs_da_geometry *geo;	/* da block geometry */
> -	const uint8_t		*name;		/* string (maybe not NULL terminated) */
> -	int		namelen;	/* length of string (maybe no NULL) */
> +	struct xfs_name	name;		/* name, length and argument  flags*/
>  	uint8_t		filetype;	/* filetype of inode for directories */
>  	uint8_t		*value;		/* set of bytes (maybe contain NULLs) */
>  	int		valuelen;	/* length of value */
> -	int		flags;		/* argument flags (eg: ATTR_NOCREATE) */
>  	xfs_dahash_t	hashval;	/* hash value of name */
>  	xfs_ino_t	inumber;	/* input/output inode number */
>  	struct xfs_inode *dp;		/* directory inode to manipulate */
> diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
> index dd6fcaa..3aadddc 100644
> --- a/fs/xfs/libxfs/xfs_dir2.c
> +++ b/fs/xfs/libxfs/xfs_dir2.c
> @@ -74,14 +74,14 @@ xfs_ascii_ci_compname(
>  	enum xfs_dacmp		result;
>  	int			i;
>  
> -	if (args->namelen != len)
> +	if (args->name.len != len)
>  		return XFS_CMP_DIFFERENT;
>  
>  	result = XFS_CMP_EXACT;
>  	for (i = 0; i < len; i++) {
> -		if (args->name[i] == name[i])
> +		if (args->name.name[i] == name[i])
>  			continue;
> -		if (tolower(args->name[i]) != tolower(name[i]))
> +		if (tolower(args->name.name[i]) != tolower(name[i]))
>  			return XFS_CMP_DIFFERENT;
>  		result = XFS_CMP_CASE;
>  	}
> @@ -265,8 +265,7 @@ xfs_dir_createname(
>  		return -ENOMEM;
>  
>  	args->geo = dp->i_mount->m_dir_geo;
> -	args->name = name->name;
> -	args->namelen = name->len;
> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>  	args->filetype = name->type;
>  	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
>  	args->inumber = inum;
> @@ -361,8 +360,7 @@ xfs_dir_lookup(
>  	 */
>  	args = kmem_zalloc(sizeof(*args), KM_NOFS);
>  	args->geo = dp->i_mount->m_dir_geo;
> -	args->name = name->name;
> -	args->namelen = name->len;
> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>  	args->filetype = name->type;
>  	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
>  	args->dp = dp;
> @@ -433,8 +431,7 @@ xfs_dir_removename(
>  		return -ENOMEM;
>  
>  	args->geo = dp->i_mount->m_dir_geo;
> -	args->name = name->name;
> -	args->namelen = name->len;
> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>  	args->filetype = name->type;
>  	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
>  	args->inumber = ino;
> @@ -494,8 +491,7 @@ xfs_dir_replace(
>  		return -ENOMEM;
>  
>  	args->geo = dp->i_mount->m_dir_geo;
> -	args->name = name->name;
> -	args->namelen = name->len;
> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>  	args->filetype = name->type;
>  	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
>  	args->inumber = inum;
> diff --git a/fs/xfs/libxfs/xfs_dir2_block.c b/fs/xfs/libxfs/xfs_dir2_block.c
> index d6ced59..592e47c 100644
> --- a/fs/xfs/libxfs/xfs_dir2_block.c
> +++ b/fs/xfs/libxfs/xfs_dir2_block.c
> @@ -355,7 +355,7 @@ xfs_dir2_block_addname(
>  	if (error)
>  		return error;
>  
> -	len = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
> +	len = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
>  
>  	/*
>  	 * Set up pointers to parts of the block.
> @@ -539,8 +539,8 @@ xfs_dir2_block_addname(
>  	 * Create the new data entry.
>  	 */
>  	dep->inumber = cpu_to_be64(args->inumber);
> -	dep->namelen = args->namelen;
> -	memcpy(dep->name, args->name, args->namelen);
> +	dep->namelen = args->name.len;
> +	memcpy(dep->name, args->name.name, args->name.len);
>  	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
>  	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
>  	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
> diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c
> index a131b52..24a7fda 100644
> --- a/fs/xfs/libxfs/xfs_dir2_leaf.c
> +++ b/fs/xfs/libxfs/xfs_dir2_leaf.c
> @@ -653,7 +653,7 @@ xfs_dir2_leaf_addname(
>  	xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
>  	ents = leafhdr.ents;
>  	bestsp = xfs_dir2_leaf_bests_p(ltp);
> -	length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
> +	length = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
>  
>  	/*
>  	 * See if there are any entries with the same hash value
> @@ -856,8 +856,8 @@ xfs_dir2_leaf_addname(
>  	 */
>  	dep = (xfs_dir2_data_entry_t *)dup;
>  	dep->inumber = cpu_to_be64(args->inumber);
> -	dep->namelen = args->namelen;
> -	memcpy(dep->name, args->name, dep->namelen);
> +	dep->namelen = args->name.len;
> +	memcpy(dep->name, args->name.name, dep->namelen);
>  	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
>  	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
>  	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
> diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
> index a0cc5e2..3c74efc 100644
> --- a/fs/xfs/libxfs/xfs_dir2_node.c
> +++ b/fs/xfs/libxfs/xfs_dir2_node.c
> @@ -666,7 +666,7 @@ xfs_dir2_leafn_lookup_for_addname(
>  		ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
>  		       free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
>  	}
> -	length = xfs_dir2_data_entsize(mp, args->namelen);
> +	length = xfs_dir2_data_entsize(mp, args->name.len);
>  	/*
>  	 * Loop over leaf entries with the right hash value.
>  	 */
> @@ -1911,7 +1911,7 @@ xfs_dir2_node_addname_int(
>  	int			needscan = 0;	/* need to rescan data frees */
>  	__be16			*tagp;		/* data entry tag pointer */
>  
> -	length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
> +	length = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
>  	error = xfs_dir2_node_find_freeblk(args, fblk, &dbno, &fbp, &freehdr,
>  					   &findex, length);
>  	if (error)
> @@ -1966,8 +1966,8 @@ xfs_dir2_node_addname_int(
>  	/* Fill in the new entry and log it. */
>  	dep = (xfs_dir2_data_entry_t *)dup;
>  	dep->inumber = cpu_to_be64(args->inumber);
> -	dep->namelen = args->namelen;
> -	memcpy(dep->name, args->name, dep->namelen);
> +	dep->namelen = args->name.len;
> +	memcpy(dep->name, args->name.name, dep->namelen);
>  	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
>  	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
>  	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
> diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
> index 7b7f6fb..058c526 100644
> --- a/fs/xfs/libxfs/xfs_dir2_sf.c
> +++ b/fs/xfs/libxfs/xfs_dir2_sf.c
> @@ -387,7 +387,7 @@ xfs_dir2_sf_addname(
>  	/*
>  	 * Compute entry (and change in) size.
>  	 */
> -	incr_isize = xfs_dir2_sf_entsize(dp->i_mount, sfp, args->namelen);
> +	incr_isize = xfs_dir2_sf_entsize(dp->i_mount, sfp, args->name.len);
>  	objchange = 0;
>  
>  	/*
> @@ -470,7 +470,7 @@ xfs_dir2_sf_addname_easy(
>  	/*
>  	 * Grow the in-inode space.
>  	 */
> -	xfs_idata_realloc(dp, xfs_dir2_sf_entsize(mp, sfp, args->namelen),
> +	xfs_idata_realloc(dp, xfs_dir2_sf_entsize(mp, sfp, args->name.len),
>  			  XFS_DATA_FORK);
>  	/*
>  	 * Need to set up again due to realloc of the inode data.
> @@ -480,9 +480,9 @@ xfs_dir2_sf_addname_easy(
>  	/*
>  	 * Fill in the new entry.
>  	 */
> -	sfep->namelen = args->namelen;
> +	sfep->namelen = args->name.len;
>  	xfs_dir2_sf_put_offset(sfep, offset);
> -	memcpy(sfep->name, args->name, sfep->namelen);
> +	memcpy(sfep->name, args->name.name, sfep->namelen);
>  	xfs_dir2_sf_put_ino(mp, sfp, sfep, args->inumber);
>  	xfs_dir2_sf_put_ftype(mp, sfep, args->filetype);
>  
> @@ -540,7 +540,7 @@ xfs_dir2_sf_addname_hard(
>  	 */
>  	for (offset = args->geo->data_first_offset,
>  	      oldsfep = xfs_dir2_sf_firstentry(oldsfp),
> -	      add_datasize = xfs_dir2_data_entsize(mp, args->namelen),
> +	      add_datasize = xfs_dir2_data_entsize(mp, args->name.len),
>  	      eof = (char *)oldsfep == &buf[old_isize];
>  	     !eof;
>  	     offset = new_offset + xfs_dir2_data_entsize(mp, oldsfep->namelen),
> @@ -570,9 +570,9 @@ xfs_dir2_sf_addname_hard(
>  	/*
>  	 * Fill in the new entry, and update the header counts.
>  	 */
> -	sfep->namelen = args->namelen;
> +	sfep->namelen = args->name.len;
>  	xfs_dir2_sf_put_offset(sfep, offset);
> -	memcpy(sfep->name, args->name, sfep->namelen);
> +	memcpy(sfep->name, args->name.name, sfep->namelen);
>  	xfs_dir2_sf_put_ino(mp, sfp, sfep, args->inumber);
>  	xfs_dir2_sf_put_ftype(mp, sfep, args->filetype);
>  	sfp->count++;
> @@ -615,7 +615,7 @@ xfs_dir2_sf_addname_pick(
>  	int			used;		/* data bytes used */
>  
>  	sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
> -	size = xfs_dir2_data_entsize(mp, args->namelen);
> +	size = xfs_dir2_data_entsize(mp, args->name.len);
>  	offset = args->geo->data_first_offset;
>  	sfep = xfs_dir2_sf_firstentry(sfp);
>  	holefit = 0;
> @@ -887,7 +887,7 @@ xfs_dir2_sf_lookup(
>  	/*
>  	 * Special case for .
>  	 */
> -	if (args->namelen == 1 && args->name[0] == '.') {
> +	if (args->name.len == 1 && args->name.name[0] == '.') {
>  		args->inumber = dp->i_ino;
>  		args->cmpresult = XFS_CMP_EXACT;
>  		args->filetype = XFS_DIR3_FT_DIR;
> @@ -896,8 +896,8 @@ xfs_dir2_sf_lookup(
>  	/*
>  	 * Special case for ..
>  	 */
> -	if (args->namelen == 2 &&
> -	    args->name[0] == '.' && args->name[1] == '.') {
> +	if (args->name.len == 2 &&
> +	    args->name.name[0] == '.' && args->name.name[1] == '.') {
>  		args->inumber = xfs_dir2_sf_get_parent_ino(sfp);
>  		args->cmpresult = XFS_CMP_EXACT;
>  		args->filetype = XFS_DIR3_FT_DIR;
> @@ -984,7 +984,7 @@ xfs_dir2_sf_removename(
>  	 * Calculate sizes.
>  	 */
>  	byteoff = (int)((char *)sfep - (char *)sfp);
> -	entsize = xfs_dir2_sf_entsize(mp, sfp, args->namelen);
> +	entsize = xfs_dir2_sf_entsize(mp, sfp, args->name.len);
>  	newsize = oldsize - entsize;
>  	/*
>  	 * Copy the part if any after the removed entry, sliding it down.
> @@ -1085,12 +1085,12 @@ xfs_dir2_sf_replace(
>  	} else
>  		i8elevated = 0;
>  
> -	ASSERT(args->namelen != 1 || args->name[0] != '.');
> +	ASSERT(args->name.len != 1 || args->name.name[0] != '.');
>  	/*
>  	 * Replace ..'s entry.
>  	 */
> -	if (args->namelen == 2 &&
> -	    args->name[0] == '.' && args->name[1] == '.') {
> +	if (args->name.len == 2 &&
> +	    args->name.name[0] == '.' && args->name.name[1] == '.') {
>  		ino = xfs_dir2_sf_get_parent_ino(sfp);
>  		ASSERT(args->inumber != ino);
>  		xfs_dir2_sf_put_parent_ino(sfp, args->inumber);
> diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
> index d9f0dd4..d4a9fe4 100644
> --- a/fs/xfs/scrub/attr.c
> +++ b/fs/xfs/scrub/attr.c
> @@ -147,17 +147,17 @@ xchk_xattr_listent(
>  		return;
>  	}
>  
> -	args.flags = ATTR_KERNOTIME;
> +	args.name.type = ATTR_KERNOTIME;
>  	if (flags & XFS_ATTR_ROOT)
> -		args.flags |= ATTR_ROOT;
> +		args.name.type |= ATTR_ROOT;
>  	else if (flags & XFS_ATTR_SECURE)
> -		args.flags |= ATTR_SECURE;
> +		args.name.type |= ATTR_SECURE;
>  	args.geo = context->dp->i_mount->m_attr_geo;
>  	args.whichfork = XFS_ATTR_FORK;
>  	args.dp = context->dp;
> -	args.name = name;
> -	args.namelen = namelen;
> -	args.hashval = xfs_da_hashname(args.name, args.namelen);
> +	args.name.name = name;
> +	args.name.len = namelen;
> +	args.hashval = xfs_da_hashname(args.name.name, args.name.len);
>  	args.trans = context->tp;
>  	args.value = xchk_xattr_valuebuf(sx->sc);
>  	args.valuelen = valuelen;
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index a86be7f..159b8af 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -1633,7 +1633,7 @@ DECLARE_EVENT_CLASS(xfs_da_class,
>  	TP_STRUCT__entry(
>  		__field(dev_t, dev)
>  		__field(xfs_ino_t, ino)
> -		__dynamic_array(char, name, args->namelen)
> +		__dynamic_array(char, name, args->name.len)
>  		__field(int, namelen)
>  		__field(xfs_dahash_t, hashval)
>  		__field(xfs_ino_t, inumber)
> @@ -1642,9 +1642,10 @@ DECLARE_EVENT_CLASS(xfs_da_class,
>  	TP_fast_assign(
>  		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
>  		__entry->ino = args->dp->i_ino;
> -		if (args->namelen)
> -			memcpy(__get_str(name), args->name, args->namelen);
> -		__entry->namelen = args->namelen;
> +		if (args->name.len)
> +			memcpy(__get_str(name), args->name.name,
> +			       args->name.len);
> +		__entry->namelen = args->name.len;
>  		__entry->hashval = args->hashval;
>  		__entry->inumber = args->inumber;
>  		__entry->op_flags = args->op_flags;
> @@ -1697,7 +1698,7 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
>  	TP_STRUCT__entry(
>  		__field(dev_t, dev)
>  		__field(xfs_ino_t, ino)
> -		__dynamic_array(char, name, args->namelen)
> +		__dynamic_array(char, name, args->name.len)
>  		__field(int, namelen)
>  		__field(int, valuelen)
>  		__field(xfs_dahash_t, hashval)
> @@ -1707,12 +1708,13 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
>  	TP_fast_assign(
>  		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
>  		__entry->ino = args->dp->i_ino;
> -		if (args->namelen)
> -			memcpy(__get_str(name), args->name, args->namelen);
> -		__entry->namelen = args->namelen;
> +		if (args->name.len)
> +			memcpy(__get_str(name), args->name.name,
> +			       args->name.len);
> +		__entry->namelen = args->name.len;
>  		__entry->valuelen = args->valuelen;
>  		__entry->hashval = args->hashval;
> -		__entry->flags = args->flags;
> +		__entry->flags = args->name.type;
>  		__entry->op_flags = args->op_flags;
>  	),
>  	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
>
Christoph Hellwig Feb. 25, 2020, 5:21 p.m. UTC | #14
On Mon, Feb 24, 2020 at 08:27:07PM -0800, Darrick J. Wong wrote:
> At this point you might as well wait for me to actually put hch's attr
> interface refactoring series into for-next (unless this series is
> already based off of that??) though Christoph might be a bit time
> constrained this week...

I can resend it.  The only change from the last version is to drop
the da_args move, I've just been waiting for more comments to not
spam the list too much..
Allison Collins Feb. 25, 2020, 11:26 p.m. UTC | #15
On 2/24/20 11:56 PM, Chandan Rajendra wrote:
> On Sunday, February 23, 2020 7:35 AM Allison Collins wrote:
>> This patch embeds an xfs_name in xfs_da_args, replacing the name, namelen, and flags
>> members.  This helps to clean up the xfs_da_args structure and make it more uniform
>> with the new xfs_name parameter being passed around.
>>
> 
> The statement "name = &args.name;" in xfs_attr_set() and xfs_attr_remove() was
> not apparent to me on first read. However your explaination to Amir's question
> about name.type being set in xfs_attr_args_init() made it clear.
> 
> Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>
Alrighty, thanks for the review!

Allison
> 
>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>> Reviewed-by: Brian Foster <bfoster@redhat.com>
>> ---
>>   fs/xfs/libxfs/xfs_attr.c        |  37 +++++++-------
>>   fs/xfs/libxfs/xfs_attr_leaf.c   | 104 +++++++++++++++++++++-------------------
>>   fs/xfs/libxfs/xfs_attr_remote.c |   2 +-
>>   fs/xfs/libxfs/xfs_da_btree.c    |   6 ++-
>>   fs/xfs/libxfs/xfs_da_btree.h    |   4 +-
>>   fs/xfs/libxfs/xfs_dir2.c        |  18 +++----
>>   fs/xfs/libxfs/xfs_dir2_block.c  |   6 +--
>>   fs/xfs/libxfs/xfs_dir2_leaf.c   |   6 +--
>>   fs/xfs/libxfs/xfs_dir2_node.c   |   8 ++--
>>   fs/xfs/libxfs/xfs_dir2_sf.c     |  30 ++++++------
>>   fs/xfs/scrub/attr.c             |  12 ++---
>>   fs/xfs/xfs_trace.h              |  20 ++++----
>>   12 files changed, 130 insertions(+), 123 deletions(-)
>>
>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
>> index 6717f47..9acdb23 100644
>> --- a/fs/xfs/libxfs/xfs_attr.c
>> +++ b/fs/xfs/libxfs/xfs_attr.c
>> @@ -72,13 +72,12 @@ xfs_attr_args_init(
>>   	args->geo = dp->i_mount->m_attr_geo;
>>   	args->whichfork = XFS_ATTR_FORK;
>>   	args->dp = dp;
>> -	args->flags = flags;
>> -	args->name = name->name;
>> -	args->namelen = name->len;
>> -	if (args->namelen >= MAXNAMELEN)
>> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>> +	args->name.type = flags;
>> +	if (args->name.len >= MAXNAMELEN)
>>   		return -EFAULT;		/* match IRIX behaviour */
>>   
>> -	args->hashval = xfs_da_hashname(args->name, args->namelen);
>> +	args->hashval = xfs_da_hashname(args->name.name, args->name.len);
>>   	return 0;
>>   }
>>   
>> @@ -236,7 +235,7 @@ xfs_attr_try_sf_addname(
>>   	 * Commit the shortform mods, and we're done.
>>   	 * NOTE: this is also the error path (EEXIST, etc).
>>   	 */
>> -	if (!error && (args->flags & ATTR_KERNOTIME) == 0)
>> +	if (!error && (args->name.type & ATTR_KERNOTIME) == 0)
>>   		xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
>>   
>>   	if (mp->m_flags & XFS_MOUNT_WSYNC)
>> @@ -357,6 +356,9 @@ xfs_attr_set(
>>   	if (error)
>>   		return error;
>>   
>> +	/* Use name now stored in args */
>> +	name = &args.name;
>> +
>>   	args.value = value;
>>   	args.valuelen = valuelen;
>>   	args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
>> @@ -372,7 +374,7 @@ xfs_attr_set(
>>   	 */
>>   	if (XFS_IFORK_Q(dp) == 0) {
>>   		int sf_size = sizeof(xfs_attr_sf_hdr_t) +
>> -			XFS_ATTR_SF_ENTSIZE_BYNAME(args.namelen, valuelen);
>> +			XFS_ATTR_SF_ENTSIZE_BYNAME(name->len, valuelen);
>>   
>>   		error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
>>   		if (error)
>> @@ -457,6 +459,9 @@ xfs_attr_remove(
>>   	if (error)
>>   		return error;
>>   
>> +	/* Use name now stored in args */
>> +	name = &args.name;
>> +
>>   	/*
>>   	 * we have no control over the attribute names that userspace passes us
>>   	 * to remove, so we have to allow the name lookup prior to attribute
>> @@ -532,10 +537,10 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
>>   	trace_xfs_attr_sf_addname(args);
>>   
>>   	retval = xfs_attr_shortform_lookup(args);
>> -	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
>> +	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
>>   		return retval;
>>   	} else if (retval == -EEXIST) {
>> -		if (args->flags & ATTR_CREATE)
>> +		if (args->name.type & ATTR_CREATE)
>>   			return retval;
>>   		retval = xfs_attr_shortform_remove(args);
>>   		if (retval)
>> @@ -545,15 +550,15 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
>>   		 * that the leaf format add routine won't trip over the attr
>>   		 * not being around.
>>   		 */
>> -		args->flags &= ~ATTR_REPLACE;
>> +		args->name.type &= ~ATTR_REPLACE;
>>   	}
>>   
>> -	if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
>> +	if (args->name.len >= XFS_ATTR_SF_ENTSIZE_MAX ||
>>   	    args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX)
>>   		return -ENOSPC;
>>   
>>   	newsize = XFS_ATTR_SF_TOTSIZE(args->dp);
>> -	newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
>> +	newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->name.len, args->valuelen);
>>   
>>   	forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize);
>>   	if (!forkoff)
>> @@ -598,11 +603,11 @@ xfs_attr_leaf_addname(
>>   	 * the given flags produce an error or call for an atomic rename.
>>   	 */
>>   	retval = xfs_attr3_leaf_lookup_int(bp, args);
>> -	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
>> +	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
>>   		xfs_trans_brelse(args->trans, bp);
>>   		return retval;
>>   	} else if (retval == -EEXIST) {
>> -		if (args->flags & ATTR_CREATE) {	/* pure create op */
>> +		if (args->name.type & ATTR_CREATE) {	/* pure create op */
>>   			xfs_trans_brelse(args->trans, bp);
>>   			return retval;
>>   		}
>> @@ -872,10 +877,10 @@ xfs_attr_node_addname(
>>   		goto out;
>>   	blk = &state->path.blk[ state->path.active-1 ];
>>   	ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
>> -	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
>> +	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
>>   		goto out;
>>   	} else if (retval == -EEXIST) {
>> -		if (args->flags & ATTR_CREATE)
>> +		if (args->name.type & ATTR_CREATE)
>>   			goto out;
>>   
>>   		trace_xfs_attr_node_replace(args);
>> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
>> index fed537a..cb5ef66 100644
>> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
>> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
>> @@ -464,7 +464,7 @@ xfs_attr_copy_value(
>>   	/*
>>   	 * No copy if all we have to do is get the length
>>   	 */
>> -	if (args->flags & ATTR_KERNOVAL) {
>> +	if (args->name.type & ATTR_KERNOVAL) {
>>   		args->valuelen = valuelen;
>>   		return 0;
>>   	}
>> @@ -679,27 +679,27 @@ xfs_attr_shortform_add(xfs_da_args_t *args, int forkoff)
>>   	sfe = &sf->list[0];
>>   	for (i = 0; i < sf->hdr.count; sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
>>   #ifdef DEBUG
>> -		if (sfe->namelen != args->namelen)
>> +		if (sfe->namelen != args->name.len)
>>   			continue;
>> -		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
>> +		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
>>   			continue;
>> -		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
>> +		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
>>   			continue;
>>   		ASSERT(0);
>>   #endif
>>   	}
>>   
>>   	offset = (char *)sfe - (char *)sf;
>> -	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
>> +	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->name.len, args->valuelen);
>>   	xfs_idata_realloc(dp, size, XFS_ATTR_FORK);
>>   	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
>>   	sfe = (xfs_attr_sf_entry_t *)((char *)sf + offset);
>>   
>> -	sfe->namelen = args->namelen;
>> +	sfe->namelen = args->name.len;
>>   	sfe->valuelen = args->valuelen;
>> -	sfe->flags = XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags);
>> -	memcpy(sfe->nameval, args->name, args->namelen);
>> -	memcpy(&sfe->nameval[args->namelen], args->value, args->valuelen);
>> +	sfe->flags = XFS_ATTR_NSP_ARGS_TO_ONDISK(args->name.type);
>> +	memcpy(sfe->nameval, args->name.name, args->name.len);
>> +	memcpy(&sfe->nameval[args->name.len], args->value, args->valuelen);
>>   	sf->hdr.count++;
>>   	be16_add_cpu(&sf->hdr.totsize, size);
>>   	xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
>> @@ -749,11 +749,11 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
>>   	for (i = 0; i < end; sfe = XFS_ATTR_SF_NEXTENTRY(sfe),
>>   					base += size, i++) {
>>   		size = XFS_ATTR_SF_ENTSIZE(sfe);
>> -		if (sfe->namelen != args->namelen)
>> +		if (sfe->namelen != args->name.len)
>>   			continue;
>> -		if (memcmp(sfe->nameval, args->name, args->namelen) != 0)
>> +		if (memcmp(sfe->nameval, args->name.name, args->name.len) != 0)
>>   			continue;
>> -		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
>> +		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
>>   			continue;
>>   		break;
>>   	}
>> @@ -816,11 +816,11 @@ xfs_attr_shortform_lookup(xfs_da_args_t *args)
>>   	sfe = &sf->list[0];
>>   	for (i = 0; i < sf->hdr.count;
>>   				sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
>> -		if (sfe->namelen != args->namelen)
>> +		if (sfe->namelen != args->name.len)
>>   			continue;
>> -		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
>> +		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
>>   			continue;
>> -		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
>> +		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
>>   			continue;
>>   		return -EEXIST;
>>   	}
>> @@ -847,13 +847,13 @@ xfs_attr_shortform_getvalue(
>>   	sfe = &sf->list[0];
>>   	for (i = 0; i < sf->hdr.count;
>>   				sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
>> -		if (sfe->namelen != args->namelen)
>> +		if (sfe->namelen != args->name.len)
>>   			continue;
>> -		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
>> +		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
>>   			continue;
>> -		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
>> +		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
>>   			continue;
>> -		return xfs_attr_copy_value(args, &sfe->nameval[args->namelen],
>> +		return xfs_attr_copy_value(args, &sfe->nameval[args->name.len],
>>   						sfe->valuelen);
>>   	}
>>   	return -ENOATTR;
>> @@ -912,13 +912,13 @@ xfs_attr_shortform_to_leaf(
>>   
>>   	sfe = &sf->list[0];
>>   	for (i = 0; i < sf->hdr.count; i++) {
>> -		nargs.name = sfe->nameval;
>> -		nargs.namelen = sfe->namelen;
>> -		nargs.value = &sfe->nameval[nargs.namelen];
>> +		nargs.name.name = sfe->nameval;
>> +		nargs.name.len = sfe->namelen;
>> +		nargs.value = &sfe->nameval[nargs.name.len];
>>   		nargs.valuelen = sfe->valuelen;
>>   		nargs.hashval = xfs_da_hashname(sfe->nameval,
>>   						sfe->namelen);
>> -		nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);
>> +		nargs.name.type = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);
>>   		error = xfs_attr3_leaf_lookup_int(bp, &nargs); /* set a->index */
>>   		ASSERT(error == -ENOATTR);
>>   		error = xfs_attr3_leaf_add(bp, &nargs);
>> @@ -1119,12 +1119,12 @@ xfs_attr3_leaf_to_shortform(
>>   			continue;
>>   		ASSERT(entry->flags & XFS_ATTR_LOCAL);
>>   		name_loc = xfs_attr3_leaf_name_local(leaf, i);
>> -		nargs.name = name_loc->nameval;
>> -		nargs.namelen = name_loc->namelen;
>> -		nargs.value = &name_loc->nameval[nargs.namelen];
>> +		nargs.name.name = name_loc->nameval;
>> +		nargs.name.len = name_loc->namelen;
>> +		nargs.value = &name_loc->nameval[nargs.name.len];
>>   		nargs.valuelen = be16_to_cpu(name_loc->valuelen);
>>   		nargs.hashval = be32_to_cpu(entry->hashval);
>> -		nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
>> +		nargs.name.type = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
>>   		xfs_attr_shortform_add(&nargs, forkoff);
>>   	}
>>   	error = 0;
>> @@ -1450,7 +1450,7 @@ xfs_attr3_leaf_add_work(
>>   				     ichdr->freemap[mapindex].size);
>>   	entry->hashval = cpu_to_be32(args->hashval);
>>   	entry->flags = tmp ? XFS_ATTR_LOCAL : 0;
>> -	entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags);
>> +	entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->name.type);
>>   	if (args->op_flags & XFS_DA_OP_RENAME) {
>>   		entry->flags |= XFS_ATTR_INCOMPLETE;
>>   		if ((args->blkno2 == args->blkno) &&
>> @@ -1474,15 +1474,16 @@ xfs_attr3_leaf_add_work(
>>   	 */
>>   	if (entry->flags & XFS_ATTR_LOCAL) {
>>   		name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
>> -		name_loc->namelen = args->namelen;
>> +		name_loc->namelen = args->name.len;
>>   		name_loc->valuelen = cpu_to_be16(args->valuelen);
>> -		memcpy((char *)name_loc->nameval, args->name, args->namelen);
>> -		memcpy((char *)&name_loc->nameval[args->namelen], args->value,
>> +		memcpy((char *)name_loc->nameval, args->name.name,
>> +		       args->name.len);
>> +		memcpy((char *)&name_loc->nameval[args->name.len], args->value,
>>   				   be16_to_cpu(name_loc->valuelen));
>>   	} else {
>>   		name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
>> -		name_rmt->namelen = args->namelen;
>> -		memcpy((char *)name_rmt->name, args->name, args->namelen);
>> +		name_rmt->namelen = args->name.len;
>> +		memcpy((char *)name_rmt->name, args->name.name, args->name.len);
>>   		entry->flags |= XFS_ATTR_INCOMPLETE;
>>   		/* just in case */
>>   		name_rmt->valuelen = 0;
>> @@ -2409,23 +2410,25 @@ xfs_attr3_leaf_lookup_int(
>>   		}
>>   		if (entry->flags & XFS_ATTR_LOCAL) {
>>   			name_loc = xfs_attr3_leaf_name_local(leaf, probe);
>> -			if (name_loc->namelen != args->namelen)
>> +			if (name_loc->namelen != args->name.len)
>>   				continue;
>> -			if (memcmp(args->name, name_loc->nameval,
>> -							args->namelen) != 0)
>> +			if (memcmp(args->name.name, name_loc->nameval,
>> +							args->name.len) != 0)
>>   				continue;
>> -			if (!xfs_attr_namesp_match(args->flags, entry->flags))
>> +			if (!xfs_attr_namesp_match(args->name.type,
>> +						   entry->flags))
>>   				continue;
>>   			args->index = probe;
>>   			return -EEXIST;
>>   		} else {
>>   			name_rmt = xfs_attr3_leaf_name_remote(leaf, probe);
>> -			if (name_rmt->namelen != args->namelen)
>> +			if (name_rmt->namelen != args->name.len)
>>   				continue;
>> -			if (memcmp(args->name, name_rmt->name,
>> -							args->namelen) != 0)
>> +			if (memcmp(args->name.name, name_rmt->name,
>> +							args->name.len) != 0)
>>   				continue;
>> -			if (!xfs_attr_namesp_match(args->flags, entry->flags))
>> +			if (!xfs_attr_namesp_match(args->name.type,
>> +						   entry->flags))
>>   				continue;
>>   			args->index = probe;
>>   			args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);
>> @@ -2467,16 +2470,17 @@ xfs_attr3_leaf_getvalue(
>>   	entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
>>   	if (entry->flags & XFS_ATTR_LOCAL) {
>>   		name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
>> -		ASSERT(name_loc->namelen == args->namelen);
>> -		ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0);
>> +		ASSERT(name_loc->namelen == args->name.len);
>> +		ASSERT(memcmp(args->name.name, name_loc->nameval,
>> +			      args->name.len) == 0);
>>   		return xfs_attr_copy_value(args,
>> -					&name_loc->nameval[args->namelen],
>> +					&name_loc->nameval[args->name.len],
>>   					be16_to_cpu(name_loc->valuelen));
>>   	}
>>   
>>   	name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
>> -	ASSERT(name_rmt->namelen == args->namelen);
>> -	ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0);
>> +	ASSERT(name_rmt->namelen == args->name.len);
>> +	ASSERT(memcmp(args->name.name, name_rmt->name, args->name.len) == 0);
>>   	args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);
>>   	args->rmtblkno = be32_to_cpu(name_rmt->valueblk);
>>   	args->rmtblkcnt = xfs_attr3_rmt_blocks(args->dp->i_mount,
>> @@ -2692,7 +2696,7 @@ xfs_attr_leaf_newentsize(
>>   {
>>   	int			size;
>>   
>> -	size = xfs_attr_leaf_entsize_local(args->namelen, args->valuelen);
>> +	size = xfs_attr_leaf_entsize_local(args->name.len, args->valuelen);
>>   	if (size < xfs_attr_leaf_entsize_local_max(args->geo->blksize)) {
>>   		if (local)
>>   			*local = 1;
>> @@ -2700,7 +2704,7 @@ xfs_attr_leaf_newentsize(
>>   	}
>>   	if (local)
>>   		*local = 0;
>> -	return xfs_attr_leaf_entsize_remote(args->namelen);
>> +	return xfs_attr_leaf_entsize_remote(args->name.len);
>>   }
>>   
>>   
>> @@ -2754,8 +2758,8 @@ xfs_attr3_leaf_clearflag(
>>   		name = (char *)name_rmt->name;
>>   	}
>>   	ASSERT(be32_to_cpu(entry->hashval) == args->hashval);
>> -	ASSERT(namelen == args->namelen);
>> -	ASSERT(memcmp(name, args->name, namelen) == 0);
>> +	ASSERT(namelen == args->name.len);
>> +	ASSERT(memcmp(name, args->name.name, namelen) == 0);
>>   #endif /* DEBUG */
>>   
>>   	entry->flags &= ~XFS_ATTR_INCOMPLETE;
>> diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
>> index 8b7f74b..df8aca5 100644
>> --- a/fs/xfs/libxfs/xfs_attr_remote.c
>> +++ b/fs/xfs/libxfs/xfs_attr_remote.c
>> @@ -397,7 +397,7 @@ xfs_attr_rmtval_get(
>>   
>>   	trace_xfs_attr_rmtval_get(args);
>>   
>> -	ASSERT(!(args->flags & ATTR_KERNOVAL));
>> +	ASSERT(!(args->name.type & ATTR_KERNOVAL));
>>   	ASSERT(args->rmtvaluelen == args->valuelen);
>>   
>>   	valuelen = args->rmtvaluelen;
>> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
>> index 875e04f..30f27d7 100644
>> --- a/fs/xfs/libxfs/xfs_da_btree.c
>> +++ b/fs/xfs/libxfs/xfs_da_btree.c
>> @@ -2125,8 +2125,10 @@ xfs_da_compname(
>>   	const unsigned char *name,
>>   	int		len)
>>   {
>> -	return (args->namelen == len && memcmp(args->name, name, len) == 0) ?
>> -					XFS_CMP_EXACT : XFS_CMP_DIFFERENT;
>> +	if (args->name.len == len && !memcmp(args->name.name, name, len))
>> +		return XFS_CMP_EXACT;
>> +
>> +	return XFS_CMP_DIFFERENT;
>>   }
>>   
>>   int
>> diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h
>> index 0f4fbb0..14f1be3 100644
>> --- a/fs/xfs/libxfs/xfs_da_btree.h
>> +++ b/fs/xfs/libxfs/xfs_da_btree.h
>> @@ -54,12 +54,10 @@ enum xfs_dacmp {
>>    */
>>   typedef struct xfs_da_args {
>>   	struct xfs_da_geometry *geo;	/* da block geometry */
>> -	const uint8_t		*name;		/* string (maybe not NULL terminated) */
>> -	int		namelen;	/* length of string (maybe no NULL) */
>> +	struct xfs_name	name;		/* name, length and argument  flags*/
>>   	uint8_t		filetype;	/* filetype of inode for directories */
>>   	uint8_t		*value;		/* set of bytes (maybe contain NULLs) */
>>   	int		valuelen;	/* length of value */
>> -	int		flags;		/* argument flags (eg: ATTR_NOCREATE) */
>>   	xfs_dahash_t	hashval;	/* hash value of name */
>>   	xfs_ino_t	inumber;	/* input/output inode number */
>>   	struct xfs_inode *dp;		/* directory inode to manipulate */
>> diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
>> index dd6fcaa..3aadddc 100644
>> --- a/fs/xfs/libxfs/xfs_dir2.c
>> +++ b/fs/xfs/libxfs/xfs_dir2.c
>> @@ -74,14 +74,14 @@ xfs_ascii_ci_compname(
>>   	enum xfs_dacmp		result;
>>   	int			i;
>>   
>> -	if (args->namelen != len)
>> +	if (args->name.len != len)
>>   		return XFS_CMP_DIFFERENT;
>>   
>>   	result = XFS_CMP_EXACT;
>>   	for (i = 0; i < len; i++) {
>> -		if (args->name[i] == name[i])
>> +		if (args->name.name[i] == name[i])
>>   			continue;
>> -		if (tolower(args->name[i]) != tolower(name[i]))
>> +		if (tolower(args->name.name[i]) != tolower(name[i]))
>>   			return XFS_CMP_DIFFERENT;
>>   		result = XFS_CMP_CASE;
>>   	}
>> @@ -265,8 +265,7 @@ xfs_dir_createname(
>>   		return -ENOMEM;
>>   
>>   	args->geo = dp->i_mount->m_dir_geo;
>> -	args->name = name->name;
>> -	args->namelen = name->len;
>> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>>   	args->filetype = name->type;
>>   	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
>>   	args->inumber = inum;
>> @@ -361,8 +360,7 @@ xfs_dir_lookup(
>>   	 */
>>   	args = kmem_zalloc(sizeof(*args), KM_NOFS);
>>   	args->geo = dp->i_mount->m_dir_geo;
>> -	args->name = name->name;
>> -	args->namelen = name->len;
>> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>>   	args->filetype = name->type;
>>   	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
>>   	args->dp = dp;
>> @@ -433,8 +431,7 @@ xfs_dir_removename(
>>   		return -ENOMEM;
>>   
>>   	args->geo = dp->i_mount->m_dir_geo;
>> -	args->name = name->name;
>> -	args->namelen = name->len;
>> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>>   	args->filetype = name->type;
>>   	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
>>   	args->inumber = ino;
>> @@ -494,8 +491,7 @@ xfs_dir_replace(
>>   		return -ENOMEM;
>>   
>>   	args->geo = dp->i_mount->m_dir_geo;
>> -	args->name = name->name;
>> -	args->namelen = name->len;
>> +	memcpy(&args->name, name, sizeof(struct xfs_name));
>>   	args->filetype = name->type;
>>   	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
>>   	args->inumber = inum;
>> diff --git a/fs/xfs/libxfs/xfs_dir2_block.c b/fs/xfs/libxfs/xfs_dir2_block.c
>> index d6ced59..592e47c 100644
>> --- a/fs/xfs/libxfs/xfs_dir2_block.c
>> +++ b/fs/xfs/libxfs/xfs_dir2_block.c
>> @@ -355,7 +355,7 @@ xfs_dir2_block_addname(
>>   	if (error)
>>   		return error;
>>   
>> -	len = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
>> +	len = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
>>   
>>   	/*
>>   	 * Set up pointers to parts of the block.
>> @@ -539,8 +539,8 @@ xfs_dir2_block_addname(
>>   	 * Create the new data entry.
>>   	 */
>>   	dep->inumber = cpu_to_be64(args->inumber);
>> -	dep->namelen = args->namelen;
>> -	memcpy(dep->name, args->name, args->namelen);
>> +	dep->namelen = args->name.len;
>> +	memcpy(dep->name, args->name.name, args->name.len);
>>   	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
>>   	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
>>   	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
>> diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c
>> index a131b52..24a7fda 100644
>> --- a/fs/xfs/libxfs/xfs_dir2_leaf.c
>> +++ b/fs/xfs/libxfs/xfs_dir2_leaf.c
>> @@ -653,7 +653,7 @@ xfs_dir2_leaf_addname(
>>   	xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
>>   	ents = leafhdr.ents;
>>   	bestsp = xfs_dir2_leaf_bests_p(ltp);
>> -	length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
>> +	length = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
>>   
>>   	/*
>>   	 * See if there are any entries with the same hash value
>> @@ -856,8 +856,8 @@ xfs_dir2_leaf_addname(
>>   	 */
>>   	dep = (xfs_dir2_data_entry_t *)dup;
>>   	dep->inumber = cpu_to_be64(args->inumber);
>> -	dep->namelen = args->namelen;
>> -	memcpy(dep->name, args->name, dep->namelen);
>> +	dep->namelen = args->name.len;
>> +	memcpy(dep->name, args->name.name, dep->namelen);
>>   	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
>>   	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
>>   	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
>> diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
>> index a0cc5e2..3c74efc 100644
>> --- a/fs/xfs/libxfs/xfs_dir2_node.c
>> +++ b/fs/xfs/libxfs/xfs_dir2_node.c
>> @@ -666,7 +666,7 @@ xfs_dir2_leafn_lookup_for_addname(
>>   		ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
>>   		       free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
>>   	}
>> -	length = xfs_dir2_data_entsize(mp, args->namelen);
>> +	length = xfs_dir2_data_entsize(mp, args->name.len);
>>   	/*
>>   	 * Loop over leaf entries with the right hash value.
>>   	 */
>> @@ -1911,7 +1911,7 @@ xfs_dir2_node_addname_int(
>>   	int			needscan = 0;	/* need to rescan data frees */
>>   	__be16			*tagp;		/* data entry tag pointer */
>>   
>> -	length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
>> +	length = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
>>   	error = xfs_dir2_node_find_freeblk(args, fblk, &dbno, &fbp, &freehdr,
>>   					   &findex, length);
>>   	if (error)
>> @@ -1966,8 +1966,8 @@ xfs_dir2_node_addname_int(
>>   	/* Fill in the new entry and log it. */
>>   	dep = (xfs_dir2_data_entry_t *)dup;
>>   	dep->inumber = cpu_to_be64(args->inumber);
>> -	dep->namelen = args->namelen;
>> -	memcpy(dep->name, args->name, dep->namelen);
>> +	dep->namelen = args->name.len;
>> +	memcpy(dep->name, args->name.name, dep->namelen);
>>   	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
>>   	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
>>   	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
>> diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
>> index 7b7f6fb..058c526 100644
>> --- a/fs/xfs/libxfs/xfs_dir2_sf.c
>> +++ b/fs/xfs/libxfs/xfs_dir2_sf.c
>> @@ -387,7 +387,7 @@ xfs_dir2_sf_addname(
>>   	/*
>>   	 * Compute entry (and change in) size.
>>   	 */
>> -	incr_isize = xfs_dir2_sf_entsize(dp->i_mount, sfp, args->namelen);
>> +	incr_isize = xfs_dir2_sf_entsize(dp->i_mount, sfp, args->name.len);
>>   	objchange = 0;
>>   
>>   	/*
>> @@ -470,7 +470,7 @@ xfs_dir2_sf_addname_easy(
>>   	/*
>>   	 * Grow the in-inode space.
>>   	 */
>> -	xfs_idata_realloc(dp, xfs_dir2_sf_entsize(mp, sfp, args->namelen),
>> +	xfs_idata_realloc(dp, xfs_dir2_sf_entsize(mp, sfp, args->name.len),
>>   			  XFS_DATA_FORK);
>>   	/*
>>   	 * Need to set up again due to realloc of the inode data.
>> @@ -480,9 +480,9 @@ xfs_dir2_sf_addname_easy(
>>   	/*
>>   	 * Fill in the new entry.
>>   	 */
>> -	sfep->namelen = args->namelen;
>> +	sfep->namelen = args->name.len;
>>   	xfs_dir2_sf_put_offset(sfep, offset);
>> -	memcpy(sfep->name, args->name, sfep->namelen);
>> +	memcpy(sfep->name, args->name.name, sfep->namelen);
>>   	xfs_dir2_sf_put_ino(mp, sfp, sfep, args->inumber);
>>   	xfs_dir2_sf_put_ftype(mp, sfep, args->filetype);
>>   
>> @@ -540,7 +540,7 @@ xfs_dir2_sf_addname_hard(
>>   	 */
>>   	for (offset = args->geo->data_first_offset,
>>   	      oldsfep = xfs_dir2_sf_firstentry(oldsfp),
>> -	      add_datasize = xfs_dir2_data_entsize(mp, args->namelen),
>> +	      add_datasize = xfs_dir2_data_entsize(mp, args->name.len),
>>   	      eof = (char *)oldsfep == &buf[old_isize];
>>   	     !eof;
>>   	     offset = new_offset + xfs_dir2_data_entsize(mp, oldsfep->namelen),
>> @@ -570,9 +570,9 @@ xfs_dir2_sf_addname_hard(
>>   	/*
>>   	 * Fill in the new entry, and update the header counts.
>>   	 */
>> -	sfep->namelen = args->namelen;
>> +	sfep->namelen = args->name.len;
>>   	xfs_dir2_sf_put_offset(sfep, offset);
>> -	memcpy(sfep->name, args->name, sfep->namelen);
>> +	memcpy(sfep->name, args->name.name, sfep->namelen);
>>   	xfs_dir2_sf_put_ino(mp, sfp, sfep, args->inumber);
>>   	xfs_dir2_sf_put_ftype(mp, sfep, args->filetype);
>>   	sfp->count++;
>> @@ -615,7 +615,7 @@ xfs_dir2_sf_addname_pick(
>>   	int			used;		/* data bytes used */
>>   
>>   	sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
>> -	size = xfs_dir2_data_entsize(mp, args->namelen);
>> +	size = xfs_dir2_data_entsize(mp, args->name.len);
>>   	offset = args->geo->data_first_offset;
>>   	sfep = xfs_dir2_sf_firstentry(sfp);
>>   	holefit = 0;
>> @@ -887,7 +887,7 @@ xfs_dir2_sf_lookup(
>>   	/*
>>   	 * Special case for .
>>   	 */
>> -	if (args->namelen == 1 && args->name[0] == '.') {
>> +	if (args->name.len == 1 && args->name.name[0] == '.') {
>>   		args->inumber = dp->i_ino;
>>   		args->cmpresult = XFS_CMP_EXACT;
>>   		args->filetype = XFS_DIR3_FT_DIR;
>> @@ -896,8 +896,8 @@ xfs_dir2_sf_lookup(
>>   	/*
>>   	 * Special case for ..
>>   	 */
>> -	if (args->namelen == 2 &&
>> -	    args->name[0] == '.' && args->name[1] == '.') {
>> +	if (args->name.len == 2 &&
>> +	    args->name.name[0] == '.' && args->name.name[1] == '.') {
>>   		args->inumber = xfs_dir2_sf_get_parent_ino(sfp);
>>   		args->cmpresult = XFS_CMP_EXACT;
>>   		args->filetype = XFS_DIR3_FT_DIR;
>> @@ -984,7 +984,7 @@ xfs_dir2_sf_removename(
>>   	 * Calculate sizes.
>>   	 */
>>   	byteoff = (int)((char *)sfep - (char *)sfp);
>> -	entsize = xfs_dir2_sf_entsize(mp, sfp, args->namelen);
>> +	entsize = xfs_dir2_sf_entsize(mp, sfp, args->name.len);
>>   	newsize = oldsize - entsize;
>>   	/*
>>   	 * Copy the part if any after the removed entry, sliding it down.
>> @@ -1085,12 +1085,12 @@ xfs_dir2_sf_replace(
>>   	} else
>>   		i8elevated = 0;
>>   
>> -	ASSERT(args->namelen != 1 || args->name[0] != '.');
>> +	ASSERT(args->name.len != 1 || args->name.name[0] != '.');
>>   	/*
>>   	 * Replace ..'s entry.
>>   	 */
>> -	if (args->namelen == 2 &&
>> -	    args->name[0] == '.' && args->name[1] == '.') {
>> +	if (args->name.len == 2 &&
>> +	    args->name.name[0] == '.' && args->name.name[1] == '.') {
>>   		ino = xfs_dir2_sf_get_parent_ino(sfp);
>>   		ASSERT(args->inumber != ino);
>>   		xfs_dir2_sf_put_parent_ino(sfp, args->inumber);
>> diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
>> index d9f0dd4..d4a9fe4 100644
>> --- a/fs/xfs/scrub/attr.c
>> +++ b/fs/xfs/scrub/attr.c
>> @@ -147,17 +147,17 @@ xchk_xattr_listent(
>>   		return;
>>   	}
>>   
>> -	args.flags = ATTR_KERNOTIME;
>> +	args.name.type = ATTR_KERNOTIME;
>>   	if (flags & XFS_ATTR_ROOT)
>> -		args.flags |= ATTR_ROOT;
>> +		args.name.type |= ATTR_ROOT;
>>   	else if (flags & XFS_ATTR_SECURE)
>> -		args.flags |= ATTR_SECURE;
>> +		args.name.type |= ATTR_SECURE;
>>   	args.geo = context->dp->i_mount->m_attr_geo;
>>   	args.whichfork = XFS_ATTR_FORK;
>>   	args.dp = context->dp;
>> -	args.name = name;
>> -	args.namelen = namelen;
>> -	args.hashval = xfs_da_hashname(args.name, args.namelen);
>> +	args.name.name = name;
>> +	args.name.len = namelen;
>> +	args.hashval = xfs_da_hashname(args.name.name, args.name.len);
>>   	args.trans = context->tp;
>>   	args.value = xchk_xattr_valuebuf(sx->sc);
>>   	args.valuelen = valuelen;
>> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
>> index a86be7f..159b8af 100644
>> --- a/fs/xfs/xfs_trace.h
>> +++ b/fs/xfs/xfs_trace.h
>> @@ -1633,7 +1633,7 @@ DECLARE_EVENT_CLASS(xfs_da_class,
>>   	TP_STRUCT__entry(
>>   		__field(dev_t, dev)
>>   		__field(xfs_ino_t, ino)
>> -		__dynamic_array(char, name, args->namelen)
>> +		__dynamic_array(char, name, args->name.len)
>>   		__field(int, namelen)
>>   		__field(xfs_dahash_t, hashval)
>>   		__field(xfs_ino_t, inumber)
>> @@ -1642,9 +1642,10 @@ DECLARE_EVENT_CLASS(xfs_da_class,
>>   	TP_fast_assign(
>>   		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
>>   		__entry->ino = args->dp->i_ino;
>> -		if (args->namelen)
>> -			memcpy(__get_str(name), args->name, args->namelen);
>> -		__entry->namelen = args->namelen;
>> +		if (args->name.len)
>> +			memcpy(__get_str(name), args->name.name,
>> +			       args->name.len);
>> +		__entry->namelen = args->name.len;
>>   		__entry->hashval = args->hashval;
>>   		__entry->inumber = args->inumber;
>>   		__entry->op_flags = args->op_flags;
>> @@ -1697,7 +1698,7 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
>>   	TP_STRUCT__entry(
>>   		__field(dev_t, dev)
>>   		__field(xfs_ino_t, ino)
>> -		__dynamic_array(char, name, args->namelen)
>> +		__dynamic_array(char, name, args->name.len)
>>   		__field(int, namelen)
>>   		__field(int, valuelen)
>>   		__field(xfs_dahash_t, hashval)
>> @@ -1707,12 +1708,13 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
>>   	TP_fast_assign(
>>   		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
>>   		__entry->ino = args->dp->i_ino;
>> -		if (args->namelen)
>> -			memcpy(__get_str(name), args->name, args->namelen);
>> -		__entry->namelen = args->namelen;
>> +		if (args->name.len)
>> +			memcpy(__get_str(name), args->name.name,
>> +			       args->name.len);
>> +		__entry->namelen = args->name.len;
>>   		__entry->valuelen = args->valuelen;
>>   		__entry->hashval = args->hashval;
>> -		__entry->flags = args->flags;
>> +		__entry->flags = args->name.type;
>>   		__entry->op_flags = args->op_flags;
>>   	),
>>   	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
>>
> 
>

Patch
diff mbox series

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 6717f47..9acdb23 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -72,13 +72,12 @@  xfs_attr_args_init(
 	args->geo = dp->i_mount->m_attr_geo;
 	args->whichfork = XFS_ATTR_FORK;
 	args->dp = dp;
-	args->flags = flags;
-	args->name = name->name;
-	args->namelen = name->len;
-	if (args->namelen >= MAXNAMELEN)
+	memcpy(&args->name, name, sizeof(struct xfs_name));
+	args->name.type = flags;
+	if (args->name.len >= MAXNAMELEN)
 		return -EFAULT;		/* match IRIX behaviour */
 
-	args->hashval = xfs_da_hashname(args->name, args->namelen);
+	args->hashval = xfs_da_hashname(args->name.name, args->name.len);
 	return 0;
 }
 
@@ -236,7 +235,7 @@  xfs_attr_try_sf_addname(
 	 * Commit the shortform mods, and we're done.
 	 * NOTE: this is also the error path (EEXIST, etc).
 	 */
-	if (!error && (args->flags & ATTR_KERNOTIME) == 0)
+	if (!error && (args->name.type & ATTR_KERNOTIME) == 0)
 		xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
 
 	if (mp->m_flags & XFS_MOUNT_WSYNC)
@@ -357,6 +356,9 @@  xfs_attr_set(
 	if (error)
 		return error;
 
+	/* Use name now stored in args */
+	name = &args.name;
+
 	args.value = value;
 	args.valuelen = valuelen;
 	args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
@@ -372,7 +374,7 @@  xfs_attr_set(
 	 */
 	if (XFS_IFORK_Q(dp) == 0) {
 		int sf_size = sizeof(xfs_attr_sf_hdr_t) +
-			XFS_ATTR_SF_ENTSIZE_BYNAME(args.namelen, valuelen);
+			XFS_ATTR_SF_ENTSIZE_BYNAME(name->len, valuelen);
 
 		error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
 		if (error)
@@ -457,6 +459,9 @@  xfs_attr_remove(
 	if (error)
 		return error;
 
+	/* Use name now stored in args */
+	name = &args.name;
+
 	/*
 	 * we have no control over the attribute names that userspace passes us
 	 * to remove, so we have to allow the name lookup prior to attribute
@@ -532,10 +537,10 @@  xfs_attr_shortform_addname(xfs_da_args_t *args)
 	trace_xfs_attr_sf_addname(args);
 
 	retval = xfs_attr_shortform_lookup(args);
-	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
+	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
 		return retval;
 	} else if (retval == -EEXIST) {
-		if (args->flags & ATTR_CREATE)
+		if (args->name.type & ATTR_CREATE)
 			return retval;
 		retval = xfs_attr_shortform_remove(args);
 		if (retval)
@@ -545,15 +550,15 @@  xfs_attr_shortform_addname(xfs_da_args_t *args)
 		 * that the leaf format add routine won't trip over the attr
 		 * not being around.
 		 */
-		args->flags &= ~ATTR_REPLACE;
+		args->name.type &= ~ATTR_REPLACE;
 	}
 
-	if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
+	if (args->name.len >= XFS_ATTR_SF_ENTSIZE_MAX ||
 	    args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX)
 		return -ENOSPC;
 
 	newsize = XFS_ATTR_SF_TOTSIZE(args->dp);
-	newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
+	newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->name.len, args->valuelen);
 
 	forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize);
 	if (!forkoff)
@@ -598,11 +603,11 @@  xfs_attr_leaf_addname(
 	 * the given flags produce an error or call for an atomic rename.
 	 */
 	retval = xfs_attr3_leaf_lookup_int(bp, args);
-	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
+	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
 		xfs_trans_brelse(args->trans, bp);
 		return retval;
 	} else if (retval == -EEXIST) {
-		if (args->flags & ATTR_CREATE) {	/* pure create op */
+		if (args->name.type & ATTR_CREATE) {	/* pure create op */
 			xfs_trans_brelse(args->trans, bp);
 			return retval;
 		}
@@ -872,10 +877,10 @@  xfs_attr_node_addname(
 		goto out;
 	blk = &state->path.blk[ state->path.active-1 ];
 	ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
-	if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) {
+	if ((args->name.type & ATTR_REPLACE) && (retval == -ENOATTR)) {
 		goto out;
 	} else if (retval == -EEXIST) {
-		if (args->flags & ATTR_CREATE)
+		if (args->name.type & ATTR_CREATE)
 			goto out;
 
 		trace_xfs_attr_node_replace(args);
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index fed537a..cb5ef66 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -464,7 +464,7 @@  xfs_attr_copy_value(
 	/*
 	 * No copy if all we have to do is get the length
 	 */
-	if (args->flags & ATTR_KERNOVAL) {
+	if (args->name.type & ATTR_KERNOVAL) {
 		args->valuelen = valuelen;
 		return 0;
 	}
@@ -679,27 +679,27 @@  xfs_attr_shortform_add(xfs_da_args_t *args, int forkoff)
 	sfe = &sf->list[0];
 	for (i = 0; i < sf->hdr.count; sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
 #ifdef DEBUG
-		if (sfe->namelen != args->namelen)
+		if (sfe->namelen != args->name.len)
 			continue;
-		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
+		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
 			continue;
-		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
+		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
 			continue;
 		ASSERT(0);
 #endif
 	}
 
 	offset = (char *)sfe - (char *)sf;
-	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
+	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->name.len, args->valuelen);
 	xfs_idata_realloc(dp, size, XFS_ATTR_FORK);
 	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
 	sfe = (xfs_attr_sf_entry_t *)((char *)sf + offset);
 
-	sfe->namelen = args->namelen;
+	sfe->namelen = args->name.len;
 	sfe->valuelen = args->valuelen;
-	sfe->flags = XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags);
-	memcpy(sfe->nameval, args->name, args->namelen);
-	memcpy(&sfe->nameval[args->namelen], args->value, args->valuelen);
+	sfe->flags = XFS_ATTR_NSP_ARGS_TO_ONDISK(args->name.type);
+	memcpy(sfe->nameval, args->name.name, args->name.len);
+	memcpy(&sfe->nameval[args->name.len], args->value, args->valuelen);
 	sf->hdr.count++;
 	be16_add_cpu(&sf->hdr.totsize, size);
 	xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
@@ -749,11 +749,11 @@  xfs_attr_shortform_remove(xfs_da_args_t *args)
 	for (i = 0; i < end; sfe = XFS_ATTR_SF_NEXTENTRY(sfe),
 					base += size, i++) {
 		size = XFS_ATTR_SF_ENTSIZE(sfe);
-		if (sfe->namelen != args->namelen)
+		if (sfe->namelen != args->name.len)
 			continue;
-		if (memcmp(sfe->nameval, args->name, args->namelen) != 0)
+		if (memcmp(sfe->nameval, args->name.name, args->name.len) != 0)
 			continue;
-		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
+		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
 			continue;
 		break;
 	}
@@ -816,11 +816,11 @@  xfs_attr_shortform_lookup(xfs_da_args_t *args)
 	sfe = &sf->list[0];
 	for (i = 0; i < sf->hdr.count;
 				sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
-		if (sfe->namelen != args->namelen)
+		if (sfe->namelen != args->name.len)
 			continue;
-		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
+		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
 			continue;
-		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
+		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
 			continue;
 		return -EEXIST;
 	}
@@ -847,13 +847,13 @@  xfs_attr_shortform_getvalue(
 	sfe = &sf->list[0];
 	for (i = 0; i < sf->hdr.count;
 				sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) {
-		if (sfe->namelen != args->namelen)
+		if (sfe->namelen != args->name.len)
 			continue;
-		if (memcmp(args->name, sfe->nameval, args->namelen) != 0)
+		if (memcmp(args->name.name, sfe->nameval, args->name.len) != 0)
 			continue;
-		if (!xfs_attr_namesp_match(args->flags, sfe->flags))
+		if (!xfs_attr_namesp_match(args->name.type, sfe->flags))
 			continue;
-		return xfs_attr_copy_value(args, &sfe->nameval[args->namelen],
+		return xfs_attr_copy_value(args, &sfe->nameval[args->name.len],
 						sfe->valuelen);
 	}
 	return -ENOATTR;
@@ -912,13 +912,13 @@  xfs_attr_shortform_to_leaf(
 
 	sfe = &sf->list[0];
 	for (i = 0; i < sf->hdr.count; i++) {
-		nargs.name = sfe->nameval;
-		nargs.namelen = sfe->namelen;
-		nargs.value = &sfe->nameval[nargs.namelen];
+		nargs.name.name = sfe->nameval;
+		nargs.name.len = sfe->namelen;
+		nargs.value = &sfe->nameval[nargs.name.len];
 		nargs.valuelen = sfe->valuelen;
 		nargs.hashval = xfs_da_hashname(sfe->nameval,
 						sfe->namelen);
-		nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);
+		nargs.name.type = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);
 		error = xfs_attr3_leaf_lookup_int(bp, &nargs); /* set a->index */
 		ASSERT(error == -ENOATTR);
 		error = xfs_attr3_leaf_add(bp, &nargs);
@@ -1119,12 +1119,12 @@  xfs_attr3_leaf_to_shortform(
 			continue;
 		ASSERT(entry->flags & XFS_ATTR_LOCAL);
 		name_loc = xfs_attr3_leaf_name_local(leaf, i);
-		nargs.name = name_loc->nameval;
-		nargs.namelen = name_loc->namelen;
-		nargs.value = &name_loc->nameval[nargs.namelen];
+		nargs.name.name = name_loc->nameval;
+		nargs.name.len = name_loc->namelen;
+		nargs.value = &name_loc->nameval[nargs.name.len];
 		nargs.valuelen = be16_to_cpu(name_loc->valuelen);
 		nargs.hashval = be32_to_cpu(entry->hashval);
-		nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
+		nargs.name.type = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
 		xfs_attr_shortform_add(&nargs, forkoff);
 	}
 	error = 0;
@@ -1450,7 +1450,7 @@  xfs_attr3_leaf_add_work(
 				     ichdr->freemap[mapindex].size);
 	entry->hashval = cpu_to_be32(args->hashval);
 	entry->flags = tmp ? XFS_ATTR_LOCAL : 0;
-	entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags);
+	entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->name.type);
 	if (args->op_flags & XFS_DA_OP_RENAME) {
 		entry->flags |= XFS_ATTR_INCOMPLETE;
 		if ((args->blkno2 == args->blkno) &&
@@ -1474,15 +1474,16 @@  xfs_attr3_leaf_add_work(
 	 */
 	if (entry->flags & XFS_ATTR_LOCAL) {
 		name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
-		name_loc->namelen = args->namelen;
+		name_loc->namelen = args->name.len;
 		name_loc->valuelen = cpu_to_be16(args->valuelen);
-		memcpy((char *)name_loc->nameval, args->name, args->namelen);
-		memcpy((char *)&name_loc->nameval[args->namelen], args->value,
+		memcpy((char *)name_loc->nameval, args->name.name,
+		       args->name.len);
+		memcpy((char *)&name_loc->nameval[args->name.len], args->value,
 				   be16_to_cpu(name_loc->valuelen));
 	} else {
 		name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
-		name_rmt->namelen = args->namelen;
-		memcpy((char *)name_rmt->name, args->name, args->namelen);
+		name_rmt->namelen = args->name.len;
+		memcpy((char *)name_rmt->name, args->name.name, args->name.len);
 		entry->flags |= XFS_ATTR_INCOMPLETE;
 		/* just in case */
 		name_rmt->valuelen = 0;
@@ -2409,23 +2410,25 @@  xfs_attr3_leaf_lookup_int(
 		}
 		if (entry->flags & XFS_ATTR_LOCAL) {
 			name_loc = xfs_attr3_leaf_name_local(leaf, probe);
-			if (name_loc->namelen != args->namelen)
+			if (name_loc->namelen != args->name.len)
 				continue;
-			if (memcmp(args->name, name_loc->nameval,
-							args->namelen) != 0)
+			if (memcmp(args->name.name, name_loc->nameval,
+							args->name.len) != 0)
 				continue;
-			if (!xfs_attr_namesp_match(args->flags, entry->flags))
+			if (!xfs_attr_namesp_match(args->name.type,
+						   entry->flags))
 				continue;
 			args->index = probe;
 			return -EEXIST;
 		} else {
 			name_rmt = xfs_attr3_leaf_name_remote(leaf, probe);
-			if (name_rmt->namelen != args->namelen)
+			if (name_rmt->namelen != args->name.len)
 				continue;
-			if (memcmp(args->name, name_rmt->name,
-							args->namelen) != 0)
+			if (memcmp(args->name.name, name_rmt->name,
+							args->name.len) != 0)
 				continue;
-			if (!xfs_attr_namesp_match(args->flags, entry->flags))
+			if (!xfs_attr_namesp_match(args->name.type,
+						   entry->flags))
 				continue;
 			args->index = probe;
 			args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);
@@ -2467,16 +2470,17 @@  xfs_attr3_leaf_getvalue(
 	entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
 	if (entry->flags & XFS_ATTR_LOCAL) {
 		name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
-		ASSERT(name_loc->namelen == args->namelen);
-		ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0);
+		ASSERT(name_loc->namelen == args->name.len);
+		ASSERT(memcmp(args->name.name, name_loc->nameval,
+			      args->name.len) == 0);
 		return xfs_attr_copy_value(args,
-					&name_loc->nameval[args->namelen],
+					&name_loc->nameval[args->name.len],
 					be16_to_cpu(name_loc->valuelen));
 	}
 
 	name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
-	ASSERT(name_rmt->namelen == args->namelen);
-	ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0);
+	ASSERT(name_rmt->namelen == args->name.len);
+	ASSERT(memcmp(args->name.name, name_rmt->name, args->name.len) == 0);
 	args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);
 	args->rmtblkno = be32_to_cpu(name_rmt->valueblk);
 	args->rmtblkcnt = xfs_attr3_rmt_blocks(args->dp->i_mount,
@@ -2692,7 +2696,7 @@  xfs_attr_leaf_newentsize(
 {
 	int			size;
 
-	size = xfs_attr_leaf_entsize_local(args->namelen, args->valuelen);
+	size = xfs_attr_leaf_entsize_local(args->name.len, args->valuelen);
 	if (size < xfs_attr_leaf_entsize_local_max(args->geo->blksize)) {
 		if (local)
 			*local = 1;
@@ -2700,7 +2704,7 @@  xfs_attr_leaf_newentsize(
 	}
 	if (local)
 		*local = 0;
-	return xfs_attr_leaf_entsize_remote(args->namelen);
+	return xfs_attr_leaf_entsize_remote(args->name.len);
 }
 
 
@@ -2754,8 +2758,8 @@  xfs_attr3_leaf_clearflag(
 		name = (char *)name_rmt->name;
 	}
 	ASSERT(be32_to_cpu(entry->hashval) == args->hashval);
-	ASSERT(namelen == args->namelen);
-	ASSERT(memcmp(name, args->name, namelen) == 0);
+	ASSERT(namelen == args->name.len);
+	ASSERT(memcmp(name, args->name.name, namelen) == 0);
 #endif /* DEBUG */
 
 	entry->flags &= ~XFS_ATTR_INCOMPLETE;
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 8b7f74b..df8aca5 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -397,7 +397,7 @@  xfs_attr_rmtval_get(
 
 	trace_xfs_attr_rmtval_get(args);
 
-	ASSERT(!(args->flags & ATTR_KERNOVAL));
+	ASSERT(!(args->name.type & ATTR_KERNOVAL));
 	ASSERT(args->rmtvaluelen == args->valuelen);
 
 	valuelen = args->rmtvaluelen;
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index 875e04f..30f27d7 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -2125,8 +2125,10 @@  xfs_da_compname(
 	const unsigned char *name,
 	int		len)
 {
-	return (args->namelen == len && memcmp(args->name, name, len) == 0) ?
-					XFS_CMP_EXACT : XFS_CMP_DIFFERENT;
+	if (args->name.len == len && !memcmp(args->name.name, name, len))
+		return XFS_CMP_EXACT;
+
+	return XFS_CMP_DIFFERENT;
 }
 
 int
diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h
index 0f4fbb0..14f1be3 100644
--- a/fs/xfs/libxfs/xfs_da_btree.h
+++ b/fs/xfs/libxfs/xfs_da_btree.h
@@ -54,12 +54,10 @@  enum xfs_dacmp {
  */
 typedef struct xfs_da_args {
 	struct xfs_da_geometry *geo;	/* da block geometry */
-	const uint8_t		*name;		/* string (maybe not NULL terminated) */
-	int		namelen;	/* length of string (maybe no NULL) */
+	struct xfs_name	name;		/* name, length and argument  flags*/
 	uint8_t		filetype;	/* filetype of inode for directories */
 	uint8_t		*value;		/* set of bytes (maybe contain NULLs) */
 	int		valuelen;	/* length of value */
-	int		flags;		/* argument flags (eg: ATTR_NOCREATE) */
 	xfs_dahash_t	hashval;	/* hash value of name */
 	xfs_ino_t	inumber;	/* input/output inode number */
 	struct xfs_inode *dp;		/* directory inode to manipulate */
diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
index dd6fcaa..3aadddc 100644
--- a/fs/xfs/libxfs/xfs_dir2.c
+++ b/fs/xfs/libxfs/xfs_dir2.c
@@ -74,14 +74,14 @@  xfs_ascii_ci_compname(
 	enum xfs_dacmp		result;
 	int			i;
 
-	if (args->namelen != len)
+	if (args->name.len != len)
 		return XFS_CMP_DIFFERENT;
 
 	result = XFS_CMP_EXACT;
 	for (i = 0; i < len; i++) {
-		if (args->name[i] == name[i])
+		if (args->name.name[i] == name[i])
 			continue;
-		if (tolower(args->name[i]) != tolower(name[i]))
+		if (tolower(args->name.name[i]) != tolower(name[i]))
 			return XFS_CMP_DIFFERENT;
 		result = XFS_CMP_CASE;
 	}
@@ -265,8 +265,7 @@  xfs_dir_createname(
 		return -ENOMEM;
 
 	args->geo = dp->i_mount->m_dir_geo;
-	args->name = name->name;
-	args->namelen = name->len;
+	memcpy(&args->name, name, sizeof(struct xfs_name));
 	args->filetype = name->type;
 	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
 	args->inumber = inum;
@@ -361,8 +360,7 @@  xfs_dir_lookup(
 	 */
 	args = kmem_zalloc(sizeof(*args), KM_NOFS);
 	args->geo = dp->i_mount->m_dir_geo;
-	args->name = name->name;
-	args->namelen = name->len;
+	memcpy(&args->name, name, sizeof(struct xfs_name));
 	args->filetype = name->type;
 	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
 	args->dp = dp;
@@ -433,8 +431,7 @@  xfs_dir_removename(
 		return -ENOMEM;
 
 	args->geo = dp->i_mount->m_dir_geo;
-	args->name = name->name;
-	args->namelen = name->len;
+	memcpy(&args->name, name, sizeof(struct xfs_name));
 	args->filetype = name->type;
 	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
 	args->inumber = ino;
@@ -494,8 +491,7 @@  xfs_dir_replace(
 		return -ENOMEM;
 
 	args->geo = dp->i_mount->m_dir_geo;
-	args->name = name->name;
-	args->namelen = name->len;
+	memcpy(&args->name, name, sizeof(struct xfs_name));
 	args->filetype = name->type;
 	args->hashval = xfs_dir2_hashname(dp->i_mount, name);
 	args->inumber = inum;
diff --git a/fs/xfs/libxfs/xfs_dir2_block.c b/fs/xfs/libxfs/xfs_dir2_block.c
index d6ced59..592e47c 100644
--- a/fs/xfs/libxfs/xfs_dir2_block.c
+++ b/fs/xfs/libxfs/xfs_dir2_block.c
@@ -355,7 +355,7 @@  xfs_dir2_block_addname(
 	if (error)
 		return error;
 
-	len = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
+	len = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
 
 	/*
 	 * Set up pointers to parts of the block.
@@ -539,8 +539,8 @@  xfs_dir2_block_addname(
 	 * Create the new data entry.
 	 */
 	dep->inumber = cpu_to_be64(args->inumber);
-	dep->namelen = args->namelen;
-	memcpy(dep->name, args->name, args->namelen);
+	dep->namelen = args->name.len;
+	memcpy(dep->name, args->name.name, args->name.len);
 	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
 	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c
index a131b52..24a7fda 100644
--- a/fs/xfs/libxfs/xfs_dir2_leaf.c
+++ b/fs/xfs/libxfs/xfs_dir2_leaf.c
@@ -653,7 +653,7 @@  xfs_dir2_leaf_addname(
 	xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
 	ents = leafhdr.ents;
 	bestsp = xfs_dir2_leaf_bests_p(ltp);
-	length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
+	length = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
 
 	/*
 	 * See if there are any entries with the same hash value
@@ -856,8 +856,8 @@  xfs_dir2_leaf_addname(
 	 */
 	dep = (xfs_dir2_data_entry_t *)dup;
 	dep->inumber = cpu_to_be64(args->inumber);
-	dep->namelen = args->namelen;
-	memcpy(dep->name, args->name, dep->namelen);
+	dep->namelen = args->name.len;
+	memcpy(dep->name, args->name.name, dep->namelen);
 	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
 	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
index a0cc5e2..3c74efc 100644
--- a/fs/xfs/libxfs/xfs_dir2_node.c
+++ b/fs/xfs/libxfs/xfs_dir2_node.c
@@ -666,7 +666,7 @@  xfs_dir2_leafn_lookup_for_addname(
 		ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
 		       free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
 	}
-	length = xfs_dir2_data_entsize(mp, args->namelen);
+	length = xfs_dir2_data_entsize(mp, args->name.len);
 	/*
 	 * Loop over leaf entries with the right hash value.
 	 */
@@ -1911,7 +1911,7 @@  xfs_dir2_node_addname_int(
 	int			needscan = 0;	/* need to rescan data frees */
 	__be16			*tagp;		/* data entry tag pointer */
 
-	length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
+	length = xfs_dir2_data_entsize(dp->i_mount, args->name.len);
 	error = xfs_dir2_node_find_freeblk(args, fblk, &dbno, &fbp, &freehdr,
 					   &findex, length);
 	if (error)
@@ -1966,8 +1966,8 @@  xfs_dir2_node_addname_int(
 	/* Fill in the new entry and log it. */
 	dep = (xfs_dir2_data_entry_t *)dup;
 	dep->inumber = cpu_to_be64(args->inumber);
-	dep->namelen = args->namelen;
-	memcpy(dep->name, args->name, dep->namelen);
+	dep->namelen = args->name.len;
+	memcpy(dep->name, args->name.name, dep->namelen);
 	xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
 	tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
index 7b7f6fb..058c526 100644
--- a/fs/xfs/libxfs/xfs_dir2_sf.c
+++ b/fs/xfs/libxfs/xfs_dir2_sf.c
@@ -387,7 +387,7 @@  xfs_dir2_sf_addname(
 	/*
 	 * Compute entry (and change in) size.
 	 */
-	incr_isize = xfs_dir2_sf_entsize(dp->i_mount, sfp, args->namelen);
+	incr_isize = xfs_dir2_sf_entsize(dp->i_mount, sfp, args->name.len);
 	objchange = 0;
 
 	/*
@@ -470,7 +470,7 @@  xfs_dir2_sf_addname_easy(
 	/*
 	 * Grow the in-inode space.
 	 */
-	xfs_idata_realloc(dp, xfs_dir2_sf_entsize(mp, sfp, args->namelen),
+	xfs_idata_realloc(dp, xfs_dir2_sf_entsize(mp, sfp, args->name.len),
 			  XFS_DATA_FORK);
 	/*
 	 * Need to set up again due to realloc of the inode data.
@@ -480,9 +480,9 @@  xfs_dir2_sf_addname_easy(
 	/*
 	 * Fill in the new entry.
 	 */
-	sfep->namelen = args->namelen;
+	sfep->namelen = args->name.len;
 	xfs_dir2_sf_put_offset(sfep, offset);
-	memcpy(sfep->name, args->name, sfep->namelen);
+	memcpy(sfep->name, args->name.name, sfep->namelen);
 	xfs_dir2_sf_put_ino(mp, sfp, sfep, args->inumber);
 	xfs_dir2_sf_put_ftype(mp, sfep, args->filetype);
 
@@ -540,7 +540,7 @@  xfs_dir2_sf_addname_hard(
 	 */
 	for (offset = args->geo->data_first_offset,
 	      oldsfep = xfs_dir2_sf_firstentry(oldsfp),
-	      add_datasize = xfs_dir2_data_entsize(mp, args->namelen),
+	      add_datasize = xfs_dir2_data_entsize(mp, args->name.len),
 	      eof = (char *)oldsfep == &buf[old_isize];
 	     !eof;
 	     offset = new_offset + xfs_dir2_data_entsize(mp, oldsfep->namelen),
@@ -570,9 +570,9 @@  xfs_dir2_sf_addname_hard(
 	/*
 	 * Fill in the new entry, and update the header counts.
 	 */
-	sfep->namelen = args->namelen;
+	sfep->namelen = args->name.len;
 	xfs_dir2_sf_put_offset(sfep, offset);
-	memcpy(sfep->name, args->name, sfep->namelen);
+	memcpy(sfep->name, args->name.name, sfep->namelen);
 	xfs_dir2_sf_put_ino(mp, sfp, sfep, args->inumber);
 	xfs_dir2_sf_put_ftype(mp, sfep, args->filetype);
 	sfp->count++;
@@ -615,7 +615,7 @@  xfs_dir2_sf_addname_pick(
 	int			used;		/* data bytes used */
 
 	sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
-	size = xfs_dir2_data_entsize(mp, args->namelen);
+	size = xfs_dir2_data_entsize(mp, args->name.len);
 	offset = args->geo->data_first_offset;
 	sfep = xfs_dir2_sf_firstentry(sfp);
 	holefit = 0;
@@ -887,7 +887,7 @@  xfs_dir2_sf_lookup(
 	/*
 	 * Special case for .
 	 */
-	if (args->namelen == 1 && args->name[0] == '.') {
+	if (args->name.len == 1 && args->name.name[0] == '.') {
 		args->inumber = dp->i_ino;
 		args->cmpresult = XFS_CMP_EXACT;
 		args->filetype = XFS_DIR3_FT_DIR;
@@ -896,8 +896,8 @@  xfs_dir2_sf_lookup(
 	/*
 	 * Special case for ..
 	 */
-	if (args->namelen == 2 &&
-	    args->name[0] == '.' && args->name[1] == '.') {
+	if (args->name.len == 2 &&
+	    args->name.name[0] == '.' && args->name.name[1] == '.') {
 		args->inumber = xfs_dir2_sf_get_parent_ino(sfp);
 		args->cmpresult = XFS_CMP_EXACT;
 		args->filetype = XFS_DIR3_FT_DIR;
@@ -984,7 +984,7 @@  xfs_dir2_sf_removename(
 	 * Calculate sizes.
 	 */
 	byteoff = (int)((char *)sfep - (char *)sfp);
-	entsize = xfs_dir2_sf_entsize(mp, sfp, args->namelen);
+	entsize = xfs_dir2_sf_entsize(mp, sfp, args->name.len);
 	newsize = oldsize - entsize;
 	/*
 	 * Copy the part if any after the removed entry, sliding it down.
@@ -1085,12 +1085,12 @@  xfs_dir2_sf_replace(
 	} else
 		i8elevated = 0;
 
-	ASSERT(args->namelen != 1 || args->name[0] != '.');
+	ASSERT(args->name.len != 1 || args->name.name[0] != '.');
 	/*
 	 * Replace ..'s entry.
 	 */
-	if (args->namelen == 2 &&
-	    args->name[0] == '.' && args->name[1] == '.') {
+	if (args->name.len == 2 &&
+	    args->name.name[0] == '.' && args->name.name[1] == '.') {
 		ino = xfs_dir2_sf_get_parent_ino(sfp);
 		ASSERT(args->inumber != ino);
 		xfs_dir2_sf_put_parent_ino(sfp, args->inumber);
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index d9f0dd4..d4a9fe4 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -147,17 +147,17 @@  xchk_xattr_listent(
 		return;
 	}
 
-	args.flags = ATTR_KERNOTIME;
+	args.name.type = ATTR_KERNOTIME;
 	if (flags & XFS_ATTR_ROOT)
-		args.flags |= ATTR_ROOT;
+		args.name.type |= ATTR_ROOT;
 	else if (flags & XFS_ATTR_SECURE)
-		args.flags |= ATTR_SECURE;
+		args.name.type |= ATTR_SECURE;
 	args.geo = context->dp->i_mount->m_attr_geo;
 	args.whichfork = XFS_ATTR_FORK;
 	args.dp = context->dp;
-	args.name = name;
-	args.namelen = namelen;
-	args.hashval = xfs_da_hashname(args.name, args.namelen);
+	args.name.name = name;
+	args.name.len = namelen;
+	args.hashval = xfs_da_hashname(args.name.name, args.name.len);
 	args.trans = context->tp;
 	args.value = xchk_xattr_valuebuf(sx->sc);
 	args.valuelen = valuelen;
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index a86be7f..159b8af 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -1633,7 +1633,7 @@  DECLARE_EVENT_CLASS(xfs_da_class,
 	TP_STRUCT__entry(
 		__field(dev_t, dev)
 		__field(xfs_ino_t, ino)
-		__dynamic_array(char, name, args->namelen)
+		__dynamic_array(char, name, args->name.len)
 		__field(int, namelen)
 		__field(xfs_dahash_t, hashval)
 		__field(xfs_ino_t, inumber)
@@ -1642,9 +1642,10 @@  DECLARE_EVENT_CLASS(xfs_da_class,
 	TP_fast_assign(
 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
 		__entry->ino = args->dp->i_ino;
-		if (args->namelen)
-			memcpy(__get_str(name), args->name, args->namelen);
-		__entry->namelen = args->namelen;
+		if (args->name.len)
+			memcpy(__get_str(name), args->name.name,
+			       args->name.len);
+		__entry->namelen = args->name.len;
 		__entry->hashval = args->hashval;
 		__entry->inumber = args->inumber;
 		__entry->op_flags = args->op_flags;
@@ -1697,7 +1698,7 @@  DECLARE_EVENT_CLASS(xfs_attr_class,
 	TP_STRUCT__entry(
 		__field(dev_t, dev)
 		__field(xfs_ino_t, ino)
-		__dynamic_array(char, name, args->namelen)
+		__dynamic_array(char, name, args->name.len)
 		__field(int, namelen)
 		__field(int, valuelen)
 		__field(xfs_dahash_t, hashval)
@@ -1707,12 +1708,13 @@  DECLARE_EVENT_CLASS(xfs_attr_class,
 	TP_fast_assign(
 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
 		__entry->ino = args->dp->i_ino;
-		if (args->namelen)
-			memcpy(__get_str(name), args->name, args->namelen);
-		__entry->namelen = args->namelen;
+		if (args->name.len)
+			memcpy(__get_str(name), args->name.name,
+			       args->name.len);
+		__entry->namelen = args->name.len;
 		__entry->valuelen = args->valuelen;
 		__entry->hashval = args->hashval;
-		__entry->flags = args->flags;
+		__entry->flags = args->name.type;
 		__entry->op_flags = args->op_flags;
 	),
 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "