[Cluster-devel] [PATCH 1/2] gfs2: Enable rgrplvb for sb_fs_format 1802

Bob Peterson rpeterso at redhat.com
Fri Feb 5 19:05:20 UTC 2021


----- Original Message -----
> Turn on rgrplvb by default for sb_fs_format > 1801.
> 
> Mount options still have to override this so a new args field to
> differentiate between 'off' and 'not specified' is added, and the new
> default is applied only when it's not specified.
> 
> Signed-off-by: Andrew Price <anprice at redhat.com>
> ---
>  fs/gfs2/incore.h     |  1 +
>  fs/gfs2/ops_fstype.c | 13 ++++++++++---
>  fs/gfs2/super.h      |  4 ++++
>  3 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
> index 8e1ab8ed4abc..ac4d5e619ecf 100644
> --- a/fs/gfs2/incore.h
> +++ b/fs/gfs2/incore.h
> @@ -585,6 +585,7 @@ struct gfs2_args {
>  	unsigned int ar_errors:2;               /* errors=withdraw | panic */
>  	unsigned int ar_nobarrier:1;            /* do not send barriers */
>  	unsigned int ar_rgrplvb:1;		/* use lvbs for rgrp info */
> +	unsigned int ar_got_rgrplvb:1;		/* Was the rgrplvb opt given? */
>  	unsigned int ar_loccookie:1;		/* use location based readdir
>  						   cookies */
>  	s32 ar_commit;				/* Commit interval */
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index 61fce59cb4d3..52fe78378faa 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -171,7 +171,8 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int
> silent)
>  		return -EINVAL;
>  	}
>  
> -	if (sb->sb_fs_format != GFS2_FORMAT_FS ||
> +	if (sb->sb_fs_format < GFS2_FS_FORMAT_MIN ||
> +	    sb->sb_fs_format > GFS2_FS_FORMAT_MAX ||
>  	    sb->sb_multihost_format != GFS2_FORMAT_MULTI) {
>  		fs_warn(sdp, "Unknown on-disk format, unable to mount\n");
>  		return -EINVAL;
> @@ -1032,13 +1033,14 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int
> silent)
>  	}
>  
>  	if (lm->lm_mount == NULL) {
> -		fs_info(sdp, "Now mounting FS...\n");
> +		fs_info(sdp, "Now mounting FS (format %u)...\n", sdp->sd_sb.sb_fs_format);
>  		complete_all(&sdp->sd_locking_init);
>  		return 0;
>  	}
>  	ret = lm->lm_mount(sdp, table);
>  	if (ret == 0)
> -		fs_info(sdp, "Joined cluster. Now mounting FS...\n");
> +		fs_info(sdp, "Joined cluster. Now mounting FS (format %u)...\n",
> +		        sdp->sd_sb.sb_fs_format);
>  	complete_all(&sdp->sd_locking_init);
>  	return ret;
>  }
> @@ -1156,6 +1158,10 @@ static int gfs2_fill_super(struct super_block *sb,
> struct fs_context *fc)
>  	if (error)
>  		goto fail_locking;
>  
> +	/* Turn rgrplvb on by default if fs format is recent enough */
> +	if (!sdp->sd_args.ar_got_rgrplvb && sdp->sd_sb.sb_fs_format > 1801)
> +		sdp->sd_args.ar_rgrplvb = 1;
> +
>  	error = wait_on_journal(sdp);
>  	if (error)
>  		goto fail_sb;
> @@ -1456,6 +1462,7 @@ static int gfs2_parse_param(struct fs_context *fc,
> struct fs_parameter *param)
>  		break;
>  	case Opt_rgrplvb:
>  		args->ar_rgrplvb = result.boolean;
> +		args->ar_got_rgrplvb = 1;
>  		break;
>  	case Opt_loccookie:
>  		args->ar_loccookie = result.boolean;
> diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h
> index c9fb2a654181..977079693bdc 100644
> --- a/fs/gfs2/super.h
> +++ b/fs/gfs2/super.h
> @@ -11,6 +11,10 @@
>  #include <linux/dcache.h>
>  #include "incore.h"
>  
> +/* Supported fs format version range */
> +#define GFS2_FS_FORMAT_MIN (1801)
> +#define GFS2_FS_FORMAT_MAX (1802)
> +
>  extern void gfs2_lm_unmount(struct gfs2_sbd *sdp);
>  
>  static inline unsigned int gfs2_jindex_size(struct gfs2_sbd *sdp)
> --
> 2.29.2
> 
> 
Looks good. Thanks, Andy!
Reviewed-by: Bob Peterson <rpeterso at redhat.com>

Bob Peterson




More information about the Cluster-devel mailing list