GFS2: Add commit= mount option
From 48c2b613616235d7c97fda5982f50100a6c79166 Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[email protected]>
Date: Wed, 13 May 2009 14:49:48 +0100
Subject: [PATCH] GFS2: Add commit= mount option
It has always been possible to adjust the gfs2 log commit interval, but only from the sysfs interface. This adds a mount option, commit=<nn>, which will be familar to ext3 users.
The sysfs interface continues to be available as well, although this might be removed in the future.
Also this patch cleans up some duplicated structures in the GFS2 sysfs code.
Signed-off-by Steven Whitehouse <[email protected]>
fs/gfs2/incore.h +1 -0
@@ -418,6 +418,7 @@ struct gfs2_args { unsigned int ar_data:2; /* ordered/writeback */ unsigned int ar_meta:1; /* mount metafs */ unsigned int ar_discard:1; /* discard requests */ +int ar_commit;/* Commit interval */ };struct gfs2_tune {
fs/gfs2/mount.c +10 -0
@@ -45,6 +45,7 @@ enum { Opt_meta, Opt_discard, Opt_nodiscard, + Opt_commit, Opt_err, };
@@ -73,6 +74,7 @@ static const match_table_t tokens = { {Opt_meta, "meta"}, {Opt_discard, "discard"}, {Opt_nodiscard, "nodiscard"}, + {Opt_commit, "commit=%d"}, {Opt_err, NULL} };
@@ -89,6 +91,7 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)char *o;int token;substring_t tmp[MAX_OPT_ARGS ]; +int rv;/* Split the options into tokens with the "," character and process them */
@@ -173,6 +176,13 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)case Opt_nodiscard: args->ar_discard =0 ;break ; +case Opt_commit: + rv =match_int (&tmp[0 ], &args->ar_commit); +if (rv || args->ar_commit <=0 ) { +fs_info (sdp,"commit mount option requires a positive numeric argument\n" ); +return rv ? rv : -EINVAL ; + } +break ;case Opt_err:default :fs_info (sdp,"invalid mount option: %s\n" , o);
fs/gfs2/ops_fstype.c +3 -1
@@ -55,7 +55,6 @@ static void gfs2_tune_init(struct gfs2_tune *gt)spin_lock_init (>->gt_spin); gt->gt_incore_log_blocks =1024 ; - gt->gt_log_flush_secs =60 ; gt->gt_recoverd_secs =60 ; gt->gt_logd_secs =1 ; gt->gt_quota_simul_sync =64 ;
@@ -1165,6 +1164,7 @@ static int fill_super(struct super_block *sb, void *data, int silent) sdp->sd_args.ar_quota =GFS2_QUOTA_DEFAULT ; sdp->sd_args.ar_data =GFS2_DATA_DEFAULT ; + sdp->sd_args.ar_commit =60 ; error =gfs2_mount_args (sdp, &sdp->sd_args, data);if (error) {
@@ -1191,6 +1191,8 @@ static int fill_super(struct super_block *sb, void *data, int silent)GFS2_BASIC_BLOCK_SHIFT ; sdp->sd_fsb2bb =1 << sdp->sd_fsb2bb_shift; + sdp->sd_tune.gt_log_flush_secs = sdp->sd_args.ar_commit; + error =init_names (sdp, silent);if (error) goto fail;
fs/gfs2/ops_super.c +12 -1
@@ -436,8 +436,12 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) {struct gfs2_sbd *sdp = sb->s_fs_info;struct gfs2_args args = sdp->sd_args;/* Default to current settings */ +struct gfs2_tune *gt = &sdp->sd_tune;int error; +spin_lock (>->gt_spin); + args.ar_commit = gt->gt_log_flush_secs; +spin_unlock (>->gt_spin); error =gfs2_mount_args (sdp, &args, data);if (error)return error;
@@ -473,6 +477,10 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) sb->s_flags |=MS_POSIXACL ; else sb->s_flags &= ~MS_POSIXACL; +spin_lock (>->gt_spin); + gt->gt_log_flush_secs = args.ar_commit; +spin_unlock (>->gt_spin); +return 0 ; }
@@ -550,6 +558,7 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) {struct gfs2_sbd *sdp = mnt->mnt_sb->s_fs_info;struct gfs2_args *args = &sdp->sd_args; +int lfsecs;if (is_ancestor (mnt->mnt_root, sdp->sd_master_dir))seq_printf (s,",meta" );
@@ -610,7 +619,9 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) }if (args->ar_discard)seq_printf (s,",discard" ); - + lfsecs = sdp->sd_tune.gt_log_flush_secs; +if (lfsecs !=60 ) +seq_printf (s,",commit=%d" , lfsecs);return 0 ; }
fs/gfs2/sys.c +34 -58
149 lines not on this page · raw message
Signature · 1 line
1.6.0.6