cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] gfs2: add barrier/nobarrier mount options
Date: Fri, 30 Oct 2009 08:03:27 +0100	[thread overview]
Message-ID: <20091030070327.GA3386@lst.de> (raw)


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 <hch@lst.de>

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->gt_spin);
 	gt->gt_log_flush_secs = args.ar_commit;
 	spin_unlock(&gt->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;



             reply	other threads:[~2009-10-30  7:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-30  7:03 Christoph Hellwig [this message]
2009-10-30 10:00 ` [Cluster-devel] Re: [PATCH] gfs2: add barrier/nobarrier mount options Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091030070327.GA3386@lst.de \
    --to=hch@lst.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).