linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>,
	xfs <linux-xfs@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] libxfs: make resync with the userspace libxfs easier
Date: Wed, 18 Dec 2019 13:07:41 -0800	[thread overview]
Message-ID: <20191218210741.GB7497@magnolia> (raw)
In-Reply-To: <b570b661-f516-f0e8-3317-5bd879fffb45@sandeen.net>

On Wed, Dec 18, 2019 at 03:00:14PM -0600, Eric Sandeen wrote:
> On 12/16/19 8:35 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Prepare to resync the userspace libxfs with the kernel libxfs.  There
> > were a few things I missed -- a couple of static inline directory
> > functions that have to be exported for xfs_repair; a couple of directory
> > naming functions that make porting much easier if they're /not/ static
> > inline; and a u16 usage that should have been uint16_t.
> > 
> > None of these things are bugs in their own right; this just makes
> > porting xfsprogs easier.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> This all seems fine - I'm wondering about prototypes in xfs_dir2_priv.h
> vs xfs_dir2.h - at this point I'm not sure why we have the two,
> help?

I think the xfs_dir2_priv header is for symbols that are internal to
directories, whereas xfs_dir2.h is for functions that higher level
functions should call to create/modify/erase directory entries.

> But whatevs, if that needs cleanup it can come later.
> 
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>

Thanks.

--D

> > ---
> >  fs/xfs/libxfs/xfs_bmap.c      |    2 +-
> >  fs/xfs/libxfs/xfs_dir2.c      |   21 +++++++++++++++++++++
> >  fs/xfs/libxfs/xfs_dir2_priv.h |   29 +++++++++--------------------
> >  fs/xfs/libxfs/xfs_dir2_sf.c   |    6 +++---
> >  4 files changed, 34 insertions(+), 24 deletions(-)
> > 
> > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> > index 4a802b3abe77..4c2e046fbfad 100644
> > --- a/fs/xfs/libxfs/xfs_bmap.c
> > +++ b/fs/xfs/libxfs/xfs_bmap.c
> > @@ -4561,7 +4561,7 @@ xfs_bmapi_convert_delalloc(
> >  	struct xfs_mount	*mp = ip->i_mount;
> >  	xfs_fileoff_t		offset_fsb = XFS_B_TO_FSBT(mp, offset);
> >  	struct xfs_bmalloca	bma = { NULL };
> > -	u16			flags = 0;
> > +	uint16_t		flags = 0;
> >  	struct xfs_trans	*tp;
> >  	int			error;
> >  
> > diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
> > index 0aa87cbde49e..dd6fcaaea318 100644
> > --- a/fs/xfs/libxfs/xfs_dir2.c
> > +++ b/fs/xfs/libxfs/xfs_dir2.c
> > @@ -724,3 +724,24 @@ xfs_dir2_namecheck(
> >  	/* There shouldn't be any slashes or nulls here */
> >  	return !memchr(name, '/', length) && !memchr(name, 0, length);
> >  }
> > +
> > +xfs_dahash_t
> > +xfs_dir2_hashname(
> > +	struct xfs_mount	*mp,
> > +	struct xfs_name		*name)
> > +{
> > +	if (unlikely(xfs_sb_version_hasasciici(&mp->m_sb)))
> > +		return xfs_ascii_ci_hashname(name);
> > +	return xfs_da_hashname(name->name, name->len);
> > +}
> > +
> > +enum xfs_dacmp
> > +xfs_dir2_compname(
> > +	struct xfs_da_args	*args,
> > +	const unsigned char	*name,
> > +	int			len)
> > +{
> > +	if (unlikely(xfs_sb_version_hasasciici(&args->dp->i_mount->m_sb)))
> > +		return xfs_ascii_ci_compname(args, name, len);
> > +	return xfs_da_compname(args, name, len);
> > +}
> > diff --git a/fs/xfs/libxfs/xfs_dir2_priv.h b/fs/xfs/libxfs/xfs_dir2_priv.h
> > index c031c53d0f0d..01ee0b926572 100644
> > --- a/fs/xfs/libxfs/xfs_dir2_priv.h
> > +++ b/fs/xfs/libxfs/xfs_dir2_priv.h
> > @@ -175,6 +175,12 @@ extern int xfs_dir2_sf_lookup(struct xfs_da_args *args);
> >  extern int xfs_dir2_sf_removename(struct xfs_da_args *args);
> >  extern int xfs_dir2_sf_replace(struct xfs_da_args *args);
> >  extern xfs_failaddr_t xfs_dir2_sf_verify(struct xfs_inode *ip);
> > +int xfs_dir2_sf_entsize(struct xfs_mount *mp,
> > +		struct xfs_dir2_sf_hdr *hdr, int len);
> > +void xfs_dir2_sf_put_ino(struct xfs_mount *mp, struct xfs_dir2_sf_hdr *hdr,
> > +		struct xfs_dir2_sf_entry *sfep, xfs_ino_t ino);
> > +void xfs_dir2_sf_put_ftype(struct xfs_mount *mp,
> > +		struct xfs_dir2_sf_entry *sfep, uint8_t ftype);
> >  
> >  /* xfs_dir2_readdir.c */
> >  extern int xfs_readdir(struct xfs_trans *tp, struct xfs_inode *dp,
> > @@ -194,25 +200,8 @@ xfs_dir2_data_entsize(
> >  	return round_up(len, XFS_DIR2_DATA_ALIGN);
> >  }
> >  
> > -static inline xfs_dahash_t
> > -xfs_dir2_hashname(
> > -	struct xfs_mount	*mp,
> > -	struct xfs_name		*name)
> > -{
> > -	if (unlikely(xfs_sb_version_hasasciici(&mp->m_sb)))
> > -		return xfs_ascii_ci_hashname(name);
> > -	return xfs_da_hashname(name->name, name->len);
> > -}
> > -
> > -static inline enum xfs_dacmp
> > -xfs_dir2_compname(
> > -	struct xfs_da_args	*args,
> > -	const unsigned char	*name,
> > -	int			len)
> > -{
> > -	if (unlikely(xfs_sb_version_hasasciici(&args->dp->i_mount->m_sb)))
> > -		return xfs_ascii_ci_compname(args, name, len);
> > -	return xfs_da_compname(args, name, len);
> > -}
> > +xfs_dahash_t xfs_dir2_hashname(struct xfs_mount *mp, struct xfs_name *name);
> > +enum xfs_dacmp xfs_dir2_compname(struct xfs_da_args *args,
> > +		const unsigned char *name, int len);
> >  
> >  #endif /* __XFS_DIR2_PRIV_H__ */
> > diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
> > index 8b94d33d232f..7b7f6fb2ea3b 100644
> > --- a/fs/xfs/libxfs/xfs_dir2_sf.c
> > +++ b/fs/xfs/libxfs/xfs_dir2_sf.c
> > @@ -37,7 +37,7 @@ static void xfs_dir2_sf_check(xfs_da_args_t *args);
> >  static void xfs_dir2_sf_toino4(xfs_da_args_t *args);
> >  static void xfs_dir2_sf_toino8(xfs_da_args_t *args);
> >  
> > -static int
> > +int
> >  xfs_dir2_sf_entsize(
> >  	struct xfs_mount	*mp,
> >  	struct xfs_dir2_sf_hdr	*hdr,
> > @@ -84,7 +84,7 @@ xfs_dir2_sf_get_ino(
> >  	return get_unaligned_be64(from) & XFS_MAXINUMBER;
> >  }
> >  
> > -static void
> > +void
> >  xfs_dir2_sf_put_ino(
> >  	struct xfs_mount		*mp,
> >  	struct xfs_dir2_sf_hdr		*hdr,
> > @@ -145,7 +145,7 @@ xfs_dir2_sf_get_ftype(
> >  	return XFS_DIR3_FT_UNKNOWN;
> >  }
> >  
> > -static void
> > +void
> >  xfs_dir2_sf_put_ftype(
> >  	struct xfs_mount	*mp,
> >  	struct xfs_dir2_sf_entry *sfep,
> > 

  reply	other threads:[~2019-12-18 21:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17  2:35 [PATCH] libxfs: make resync with the userspace libxfs easier Darrick J. Wong
2019-12-18 21:00 ` Eric Sandeen
2019-12-18 21:07   ` Darrick J. Wong [this message]
2019-12-24  8:29 ` Christoph Hellwig
2019-12-24 21:27   ` Darrick J. Wong
2020-01-07 14:18     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191218210741.GB7497@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).