On Thu, Sep 03, 2020 at 06:18:59PM +0200, Carlos Maiolino wrote: > xfs_attr_sf_totsize() requires access to xfs_inode structure, so, once > xfs_attr_shortform_addname() is its only user, move it to xfs_attr.c > instead of playing with more #includes. > > Signed-off-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx> > --- > > Changelog: > V2: > - keep macro comments above inline functions > V3: > - Add extra spacing in xfs_attr_sf_totsize() > - Fix open curling braces on inline functions > - use void * casting on xfs_attr_sf_nextentry() > V4: > - Fix open curling braces > - remove unneeded parenthesis > > fs/xfs/libxfs/xfs_attr.c | 15 ++++++++++++--- > fs/xfs/libxfs/xfs_attr_leaf.c | 18 +++++++++--------- > fs/xfs/libxfs/xfs_attr_sf.h | 30 +++++++++++++++++++----------- > fs/xfs/xfs_attr_list.c | 4 ++-- > 4 files changed, 42 insertions(+), 25 deletions(-) Couple of minor nits below. > diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c > index 2e055c079f397..16ef80943b8ef 100644 > --- a/fs/xfs/libxfs/xfs_attr.c > +++ b/fs/xfs/libxfs/xfs_attr.c > @@ -428,7 +428,7 @@ xfs_attr_set( > */ > if (XFS_IFORK_Q(dp) == 0) { > int sf_size = sizeof(struct xfs_attr_sf_hdr) + > - XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, > + xfs_attr_sf_entsize_byname(args->namelen, > args->valuelen); > > error = xfs_bmap_add_attrfork(dp, sf_size, rsvd); > @@ -523,6 +523,15 @@ xfs_attr_set( > * External routines when attribute list is inside the inode > *========================================================================*/ > > +/* total space in use */ Comment is redundant. > +static inline int xfs_attr_sf_totsize(struct xfs_inode *dp) > +{ > + struct xfs_attr_shortform *sf = > + (struct xfs_attr_shortform *)dp->i_afp->if_u1.if_data; > + > + return be16_to_cpu(sf->hdr.totsize); > +} If you have to break the declaration line like that, you may as well just do: + struct xfs_attr_shortform *sf; + + sf = (struct xfs_attr_shortform *)dp->i_afp->if_u1.if_data; + return be16_to_cpu(sf->hdr.totsize); Otherwise the patch looks fine. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx