diff mbox series

xfs: constify feature checks

Message ID 20250113043120.2054080-1-hch@lst.de (mailing list archive)
State Accepted, archived
Headers show
Series xfs: constify feature checks | expand

Commit Message

Christoph Hellwig Jan. 13, 2025, 4:31 a.m. UTC
They will eventually be needed to be const for zoned growfs, but even
now having such simpler helpers as const as possible is a good thing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
 fs/xfs/libxfs/xfs_rtgroup.c |  2 +-
 fs/xfs/scrub/scrub.h        |  2 +-
 fs/xfs/xfs_mount.h          | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

Comments

Carlos Maiolino Jan. 13, 2025, 1:38 p.m. UTC | #1
On Mon, Jan 13, 2025 at 05:31:20AM +0100, Christoph Hellwig wrote:
> They will eventually be needed to be const for zoned growfs, but even
> now having such simpler helpers as const as possible is a good thing.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> ---

Looks good to me.

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

>  fs/xfs/libxfs/xfs_rtgroup.c |  2 +-
>  fs/xfs/scrub/scrub.h        |  2 +-
>  fs/xfs/xfs_mount.h          | 10 +++++-----
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_rtgroup.c b/fs/xfs/libxfs/xfs_rtgroup.c
> index a6468e591232..d84d32f1b48f 100644
> --- a/fs/xfs/libxfs/xfs_rtgroup.c
> +++ b/fs/xfs/libxfs/xfs_rtgroup.c
> @@ -338,7 +338,7 @@ struct xfs_rtginode_ops {
>  	unsigned int		fmt_mask; /* all valid data fork formats */
>  
>  	/* Does the fs have this feature? */
> -	bool			(*enabled)(struct xfs_mount *mp);
> +	bool			(*enabled)(const struct xfs_mount *mp);
>  
>  	/* Create this rtgroup metadata inode and initialize it. */
>  	int			(*create)(struct xfs_rtgroup *rtg,
> diff --git a/fs/xfs/scrub/scrub.h b/fs/xfs/scrub/scrub.h
> index a1086f1f06d0..a3f1abc91390 100644
> --- a/fs/xfs/scrub/scrub.h
> +++ b/fs/xfs/scrub/scrub.h
> @@ -96,7 +96,7 @@ struct xchk_meta_ops {
>  	int		(*repair_eval)(struct xfs_scrub *sc);
>  
>  	/* Decide if we even have this piece of metadata. */
> -	bool		(*has)(struct xfs_mount *);
> +	bool		(*has)(const struct xfs_mount *);
>  
>  	/* type describing required/allowed inputs */
>  	enum xchk_type	type;
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index 9a1516080e63..fbed172d6770 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -357,7 +357,7 @@ typedef struct xfs_mount {
>  #define XFS_FEAT_NOUUID		(1ULL << 63)	/* ignore uuid during mount */
>  
>  #define __XFS_HAS_FEAT(name, NAME) \
> -static inline bool xfs_has_ ## name (struct xfs_mount *mp) \
> +static inline bool xfs_has_ ## name (const struct xfs_mount *mp) \
>  { \
>  	return mp->m_features & XFS_FEAT_ ## NAME; \
>  }
> @@ -393,25 +393,25 @@ __XFS_HAS_FEAT(large_extent_counts, NREXT64)
>  __XFS_HAS_FEAT(exchange_range, EXCHANGE_RANGE)
>  __XFS_HAS_FEAT(metadir, METADIR)
>  
> -static inline bool xfs_has_rtgroups(struct xfs_mount *mp)
> +static inline bool xfs_has_rtgroups(const struct xfs_mount *mp)
>  {
>  	/* all metadir file systems also allow rtgroups */
>  	return xfs_has_metadir(mp);
>  }
>  
> -static inline bool xfs_has_rtsb(struct xfs_mount *mp)
> +static inline bool xfs_has_rtsb(const struct xfs_mount *mp)
>  {
>  	/* all rtgroups filesystems with an rt section have an rtsb */
>  	return xfs_has_rtgroups(mp) && xfs_has_realtime(mp);
>  }
>  
> -static inline bool xfs_has_rtrmapbt(struct xfs_mount *mp)
> +static inline bool xfs_has_rtrmapbt(const struct xfs_mount *mp)
>  {
>  	return xfs_has_rtgroups(mp) && xfs_has_realtime(mp) &&
>  	       xfs_has_rmapbt(mp);
>  }
>  
> -static inline bool xfs_has_rtreflink(struct xfs_mount *mp)
> +static inline bool xfs_has_rtreflink(const struct xfs_mount *mp)
>  {
>  	return xfs_has_metadir(mp) && xfs_has_realtime(mp) &&
>  	       xfs_has_reflink(mp);
> -- 
> 2.45.2
> 
>
Carlos Maiolino Jan. 14, 2025, 10:30 a.m. UTC | #2
On Mon, 13 Jan 2025 05:31:20 +0100, Christoph Hellwig wrote:
> They will eventually be needed to be const for zoned growfs, but even
> now having such simpler helpers as const as possible is a good thing.
> 
> 

Applied to for-next, thanks!

[1/1] xfs: constify feature checks
      commit: 183d988ae9e7ada9d7d4333e2289256e74a5ab5b

Best regards,
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_rtgroup.c b/fs/xfs/libxfs/xfs_rtgroup.c
index a6468e591232..d84d32f1b48f 100644
--- a/fs/xfs/libxfs/xfs_rtgroup.c
+++ b/fs/xfs/libxfs/xfs_rtgroup.c
@@ -338,7 +338,7 @@  struct xfs_rtginode_ops {
 	unsigned int		fmt_mask; /* all valid data fork formats */
 
 	/* Does the fs have this feature? */
-	bool			(*enabled)(struct xfs_mount *mp);
+	bool			(*enabled)(const struct xfs_mount *mp);
 
 	/* Create this rtgroup metadata inode and initialize it. */
 	int			(*create)(struct xfs_rtgroup *rtg,
diff --git a/fs/xfs/scrub/scrub.h b/fs/xfs/scrub/scrub.h
index a1086f1f06d0..a3f1abc91390 100644
--- a/fs/xfs/scrub/scrub.h
+++ b/fs/xfs/scrub/scrub.h
@@ -96,7 +96,7 @@  struct xchk_meta_ops {
 	int		(*repair_eval)(struct xfs_scrub *sc);
 
 	/* Decide if we even have this piece of metadata. */
-	bool		(*has)(struct xfs_mount *);
+	bool		(*has)(const struct xfs_mount *);
 
 	/* type describing required/allowed inputs */
 	enum xchk_type	type;
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 9a1516080e63..fbed172d6770 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -357,7 +357,7 @@  typedef struct xfs_mount {
 #define XFS_FEAT_NOUUID		(1ULL << 63)	/* ignore uuid during mount */
 
 #define __XFS_HAS_FEAT(name, NAME) \
-static inline bool xfs_has_ ## name (struct xfs_mount *mp) \
+static inline bool xfs_has_ ## name (const struct xfs_mount *mp) \
 { \
 	return mp->m_features & XFS_FEAT_ ## NAME; \
 }
@@ -393,25 +393,25 @@  __XFS_HAS_FEAT(large_extent_counts, NREXT64)
 __XFS_HAS_FEAT(exchange_range, EXCHANGE_RANGE)
 __XFS_HAS_FEAT(metadir, METADIR)
 
-static inline bool xfs_has_rtgroups(struct xfs_mount *mp)
+static inline bool xfs_has_rtgroups(const struct xfs_mount *mp)
 {
 	/* all metadir file systems also allow rtgroups */
 	return xfs_has_metadir(mp);
 }
 
-static inline bool xfs_has_rtsb(struct xfs_mount *mp)
+static inline bool xfs_has_rtsb(const struct xfs_mount *mp)
 {
 	/* all rtgroups filesystems with an rt section have an rtsb */
 	return xfs_has_rtgroups(mp) && xfs_has_realtime(mp);
 }
 
-static inline bool xfs_has_rtrmapbt(struct xfs_mount *mp)
+static inline bool xfs_has_rtrmapbt(const struct xfs_mount *mp)
 {
 	return xfs_has_rtgroups(mp) && xfs_has_realtime(mp) &&
 	       xfs_has_rmapbt(mp);
 }
 
-static inline bool xfs_has_rtreflink(struct xfs_mount *mp)
+static inline bool xfs_has_rtreflink(const struct xfs_mount *mp)
 {
 	return xfs_has_metadir(mp) && xfs_has_realtime(mp) &&
 	       xfs_has_reflink(mp);