From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Date: Fri, 30 Oct 2009 08:03:27 +0100 Subject: [Cluster-devel] [PATCH] gfs2: add barrier/nobarrier mount options Message-ID: <20091030070327.GA3386@lst.de> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 Index: linux-2.6/fs/gfs2/incore.h =================================================================== --- linux-2.6.orig/fs/gfs2/incore.h 2009-10-30 07:43:42.246023792 +0100 +++ linux-2.6/fs/gfs2/incore.h 2009-10-30 07:44:11.173255988 +0100 @@ -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 =================================================================== --- linux-2.6.orig/fs/gfs2/super.c 2009-10-30 07:44:29.832024397 +0100 +++ linux-2.6/fs/gfs2/super.c 2009-10-30 07:53:24.117033618 +0100 @@ -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 *sdp case 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 =================================================================== --- linux-2.6.orig/fs/gfs2/ops_fstype.c 2009-10-30 07:52:11.050003877 +0100 +++ linux-2.6/fs/gfs2/ops_fstype.c 2009-10-30 07:52:53.053005337 +0100 @@ -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;