Re: [PATCH] xfs: compile out v4 support if disabled

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

 



On Tue, Mar 19, 2024 at 05:19:51PM +1000, Christoph Hellwig wrote:
> Add a strategic IS_ENABLED to let the compiler eliminate the unused
> non-crc code is CONFIG_XFS_SUPPORT_V4 is disabled.
> 
> This saves almost 20k worth of .text for my .config:
> 
> $ size xfs.o.*
>    text	   data	    bss	    dec	    hex	filename
> 1351126	 294836	    592	1646554	 191fda	xfs.o.new
> 1371453	 294868	    592	1666913	 196f61	xfs.o.old
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  fs/xfs/xfs_mount.h |  7 ++++++-
>  fs/xfs/xfs_super.c | 22 +++++++++++++---------
>  2 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index e880aa48de68bb..24fe6e7913c49f 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -327,6 +327,12 @@ static inline void xfs_add_ ## name (struct xfs_mount *mp) \
>  	xfs_sb_version_add ## name(&mp->m_sb); \
>  }
>  
> +static inline bool xfs_has_crc(struct xfs_mount *mp)
> +{
> +	return IS_ENABLED(CONFIG_XFS_SUPPORT_V4) &&
> +		(mp->m_features & XFS_FEAT_CRC);
> +}

Is that right? This can only return true if V4 support is compiled
in, but it should be the other way around - always return true if
V4 support is not compiled in. i.e:

	if (!IS_ENABLED(CONFIG_XFS_SUPPORT_V4))
		return true;
	return mp->m_features & XFS_FEAT_CRC;

-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