On Thu, Sep 03, 2020 at 04:28:39PM +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() > > fs/xfs/libxfs/xfs_attr.c | 14 +++++++++++--- > 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, 41 insertions(+), 25 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c > index 2e055c079f397..982014499f1ff 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,14 @@ xfs_attr_set( > * External routines when attribute list is inside the inode > *========================================================================*/ > > +/* total space in use */ > +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); The { should go on a line by its own. > +static inline struct xfs_attr_sf_entry * > +xfs_attr_sf_nextentry(struct xfs_attr_sf_entry *sfep) > +{ > + return (void *)(sfep) + xfs_attr_sf_entsize(sfep); No need for the braces around sfep.