gfs2: add barrier/nobarrier mount options
PATCH 1/1 gfs2: add barrier/nobarrier mount options
Currently gfs2 issues barrier unconditionally. There are various reasons to disable them, be that just for testing or for stupid devices flushing large battert backed caches. Add a nobarrier option that matches xfs and btrfs for this. Also add a symmetric barrier option to turn it back on at remount time.
fs/gfs2/incore.h +1 -0
@@ -429,6 +429,7 @@ struct gfs2_args { unsigned int ar_meta:1; /* mount metafs */ unsigned int ar_discard:1; /* discard requests */ unsigned int ar_errors:2; /* errors=withdraw | panic */ + unsigned int ar_nobarrier:1; /* do not send barriers */int ar_commit;/* Commit interval */ };
fs/gfs2/super.c +14 -0
@@ -70,6 +70,8 @@ enum { Opt_commit, Opt_err_withdraw, Opt_err_panic, + Opt_barrier, + Opt_nobarrier, Opt_error, };
@@ -98,6 +100,8 @@ static const match_table_t tokens = { {Opt_meta, "meta"}, {Opt_discard, "discard"}, {Opt_nodiscard, "nodiscard"}, + {Opt_barrier, "barrier"}, + {Opt_nobarrier, "nobarrier"}, {Opt_commit, "commit=%d"}, {Opt_err_withdraw, "errors=withdraw"}, {Opt_err_panic, "errors=panic"},
@@ -207,6 +211,12 @@ int gfs2_mount_args(struct gfs2_sbd *sdpcase Opt_nodiscard: args->ar_discard =0 ;break ; +case Opt_barrier: + args->ar_nobarrier =0 ; +break ; +case Opt_nobarrier: + args->ar_nobarrier =1 ; +break ;case Opt_commit: rv =match_int (&tmp[0 ], &args->ar_commit);if (rv || args->ar_commit <=0 ) {
@@ -1097,6 +1107,10 @@ static int gfs2_remount_fs(struct super_ sb->s_flags |=MS_POSIXACL ; else sb->s_flags &= ~MS_POSIXACL; +if (sdp->sd_args.ar_nobarrier) +set_bit (SDF_NOBARRIERS , &sdp->sd_flags); +else +clear_bit (SDF_NOBARRIERS , &sdp->sd_flags);spin_lock (>->gt_spin); gt->gt_log_flush_secs = args.ar_commit;spin_unlock (>->gt_spin);
fs/gfs2/ops_fstype.c +2 -0
@@ -1143,6 +1143,8 @@ static int fill_super(struct super_block }if (sdp->sd_args.ar_posix_acl) sb->s_flags |=MS_POSIXACL ; +if (sdp->sd_args.ar_nobarrier) +set_bit (SDF_NOBARRIERS , &sdp->sd_flags); sb->s_magic =GFS2_MAGIC ; sb->s_op = &gfs2_super_ops;
Hi,
Thanks for the patch. I've pushed it to the -nmw tree now. I've also added a two-liner of my own to display the nobarrier option in /proc/mounts,
Steve.
Quoted 79 lines · Christoph Hellwig
Currently gfs2 issues barrier unconditionally. There are various reasons to disable them, be that just for testing or for stupid devices flushing large battert backed caches. Add a nobarrier option that matches xfs and btrfs for this. Also add a symmetric barrier option to turn it back on at remount time.
Signed-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/fs/gfs2/incore.h
===================================================================fs/gfs2/incore.h +1
-0@@ -429,6 +429,7 @@ struct gfs2_args { unsigned int ar_meta:1; /* mount metafs */ unsigned int ar_discard:1; /* discard requests */ unsigned int ar_errors:2; /* errors=withdraw | panic */ + unsigned int ar_nobarrier:1; /* do not send barriers */int ar_commit;/* Commit interval */ };Index:
linux-2.6/fs/gfs2/super.c
===================================================================fs/gfs2/super.c +14
-0@@ -70,6 +70,8 @@ enum { Opt_commit, Opt_err_withdraw, Opt_err_panic, + Opt_barrier, + Opt_nobarrier, Opt_error, };@@ -98,6 +100,8 @@ static const match_table_t tokens = { {Opt_meta, "meta"}, {Opt_discard, "discard"}, {Opt_nodiscard, "nodiscard"}, + {Opt_barrier, "barrier"}, + {Opt_nobarrier, "nobarrier"}, {Opt_commit, "commit=%d"}, {Opt_err_withdraw, "errors=withdraw"}, {Opt_err_panic, "errors=panic"},@@ -207,6 +211,12 @@ int gfs2_mount_args(struct gfs2_sbd *sdpcase Opt_nodiscard: args->ar_discard =0 ;break ; +case Opt_barrier: + args->ar_nobarrier =0 ; +break ; +case Opt_nobarrier: + args->ar_nobarrier =1 ; +break ;case Opt_commit: rv =match_int (&tmp[0 ], &args->ar_commit);if (rv || args->ar_commit <=0 ) {@@ -1097,6 +1107,10 @@ static int gfs2_remount_fs(struct super_ sb->s_flags |=MS_POSIXACL ; else sb->s_flags &= ~MS_POSIXACL; +if (sdp->sd_args.ar_nobarrier) +set_bit (SDF_NOBARRIERS , &sdp->sd_flags); +else +clear_bit (SDF_NOBARRIERS , &sdp->sd_flags);spin_lock (>->gt_spin); gt->gt_log_flush_secs = args.ar_commit;spin_unlock (>->gt_spin);Index:
linux-2.6/fs/gfs2/ops_fstype.c
===================================================================fs/gfs2/ops_fstype.c +2
-0@@ -1143,6 +1143,8 @@ static int fill_super(struct super_block }if (sdp->sd_args.ar_posix_acl) sb->s_flags |=MS_POSIXACL ; +if (sdp->sd_args.ar_nobarrier) +set_bit (SDF_NOBARRIERS , &sdp->sd_flags); sb->s_magic =GFS2_MAGIC ; sb->s_op = &gfs2_super_ops;