Re: [PATCH 10/16] xfs: convert xfs_fs_geometry to use mount feature checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 14, 2021 at 04:15:49PM -0700, Darrick J. Wong wrote:
> On Wed, Jul 14, 2021 at 02:19:06PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > 
> > Reporting filesystem features to userspace is currently superblock
> > based. Now we have a general mount-based feature infrastructure,
> > switch to using the xfs_mount rather than the superblock directly.
> > 
> > This reduces the size of the function by over 300 bytes.
> > 
> > $ size -t fs/xfs/built-in.a
> > 	text    data     bss     dec     hex filename
> > before	1127855  311352     484 1439691  15f7cb (TOTALS)
> > after	1127535  311352     484 1439371  15f68b (TOTALS)
> > 
> > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> > ---
> >  fs/xfs/libxfs/xfs_sb.c | 46 ++++++++++++++++++++++--------------------
> >  fs/xfs/libxfs/xfs_sb.h |  2 +-
> >  fs/xfs/xfs_ioctl.c     |  2 +-
> >  fs/xfs/xfs_ioctl32.c   |  2 +-
> >  4 files changed, 27 insertions(+), 25 deletions(-)
> > 
> > diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> > index baaec7e6a975..5eaf14b6fe3c 100644
> > --- a/fs/xfs/libxfs/xfs_sb.c
> > +++ b/fs/xfs/libxfs/xfs_sb.c
> > @@ -1016,10 +1016,12 @@ xfs_sync_sb_buf(
> >  
> >  void
> >  xfs_fs_geometry(
> > -	struct xfs_sb		*sbp,
> > +	struct xfs_mount	*mp,
> 
> Hmm.  I /think/ this won't cause problems in userspace, because db
> passes in &mp->m_sb, and mkfs passes in sbp, which points to &mp->m_sb,
> and mp itself points to &mbuf...

Yes, AFAICT that is correct. mkfs.xfs has the same setup so it
should work there, too.

> >  	struct xfs_fsop_geom	*geo,
> >  	int			struct_version)
> >  {
> > +	struct xfs_sb		*sbp = &mp->m_sb;
> > +
> >  	memset(geo, 0, sizeof(struct xfs_fsop_geom));
> >  
> >  	geo->blocksize = sbp->sb_blocksize;
> > @@ -1050,51 +1052,51 @@ xfs_fs_geometry(
> >  	geo->flags = XFS_FSOP_GEOM_FLAGS_NLINK |
> >  		     XFS_FSOP_GEOM_FLAGS_DIRV2 |
> >  		     XFS_FSOP_GEOM_FLAGS_EXTFLG;
> > -	if (xfs_sb_version_hasattr(sbp))
> > +	if (xfs_has_attr(mp))
> 
> ...provided those utilities set m_features before we get to this point,
> right?  And provided that libxfs_init will take care of that, I think
> only mkfs would need special consideration, right?

Yup, that's how I read the usrespace situation - the superblock we
pass to xfs_fs_geometry() is always attached to a mount structure,
and we'll set up the features field in the mount when we first read
in the superblock in libxfs_init(). mkfs might require a specific
call to set up the m_features field after the superblock is
finalised (i.e in initialise_mount()), but other than that I
think it all just works...

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux