public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 4/12] tunable ext3 commit interval
@ 2002-08-10  0:56 Andrew Morton
  2002-08-11 10:15 ` Vincent Bernat
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2002-08-10  0:56 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: lkml



The patch from Stephen Tweedie allows users to modify the journal
commit interval for the ext3 filesystem.

The commit interval is normally five seconds.  For portable computers
with spun-down drives it is advantageous to be able to increase the
commit interval.

There may also be advantages in decreasing the commit interval for
specialised applications such as heavily-loaded NFS servers which are
using synchronous exports.

The laptop users will also need to increase the pdflush periodic
writeback interval (/proc/sys/vm/dirty_writeback_centisecs), because
the `kupdate' activity also forces a commit.

To specify the commit interval, use

	mount -o commit=30 /dev/hda1 /mnt/whatever

or
	mount -o remount,commit=30 /dev/hda1

The commit interval is specified in units of seconds.



 super.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions, 1 deletion

--- 2.5.30/fs/ext3/super.c~ext3-commit-interval	Fri Aug  9 17:36:40 2002
+++ 2.5.30-akpm/fs/ext3/super.c	Fri Aug  9 17:36:41 2002
@@ -696,6 +696,11 @@ static int parse_options (char * options
 				*mount_options &= ~EXT3_MOUNT_DATA_FLAGS;
 				*mount_options |= data_opt;
 			}
+		} else if (!strcmp (this_char, "commit")) {
+			unsigned long v;
+			if (want_numeric(value, "commit", &v))
+				return 0;
+			sbi->s_commit_interval = (HZ * v);
 		} else {
 			printk (KERN_ERR 
 				"EXT3-fs: Unrecognized mount option %s\n",
@@ -1260,6 +1265,22 @@ out_fail:
 	return -EINVAL;
 }
 
+/*
+ * Setup any per-fs journal parameters now.  We'll do this both on
+ * initial mount, once the journal has been initialised but before we've
+ * done any recovery; and again on any subsequent remount. 
+ */
+static void ext3_init_journal_params(struct ext3_sb_info *sbi, 
+				     journal_t *journal)
+{
+	if (sbi->s_commit_interval)
+		journal->j_commit_interval = sbi->s_commit_interval;
+	/* We could also set up an ext3-specific default for the commit
+	 * interval here, but for now we'll just fall back to the jbd
+	 * default. */
+}
+
+
 static journal_t *ext3_get_journal(struct super_block *sb, int journal_inum)
 {
 	struct inode *journal_inode;
@@ -1294,7 +1315,7 @@ static journal_t *ext3_get_journal(struc
 		printk(KERN_ERR "EXT3-fs: Could not load journal inode\n");
 		iput(journal_inode);
 	}
-	
+	ext3_init_journal_params(EXT3_SB(sb), journal);
 	return journal;
 }
 
@@ -1371,6 +1392,7 @@ static journal_t *ext3_get_dev_journal(s
 		goto out_journal;
 	}
 	EXT3_SB(sb)->journal_bdev = bdev;
+	ext3_init_journal_params(EXT3_SB(sb), journal);
 	return journal;
 out_journal:
 	journal_destroy(journal);
@@ -1667,6 +1689,8 @@ int ext3_remount (struct super_block * s
 
 	es = sbi->s_es;
 
+	ext3_init_journal_params(sbi, sbi->s_journal);
+	
 	if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) {
 		if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
 			return -EROFS;

.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 4/12] tunable ext3 commit interval
  2002-08-10  0:56 [patch 4/12] tunable ext3 commit interval Andrew Morton
@ 2002-08-11 10:15 ` Vincent Bernat
  2002-08-11 10:30   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Bernat @ 2002-08-11 10:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus Torvalds, lkml, noflushd-devel, sct

OoO En cette nuit striée d'éclairs du samedi 10 août 2002, vers 02:56,
Andrew Morton <akpm@zip.com.au> disait:

> The patch from Stephen Tweedie allows users to modify the journal
> commit interval for the ext3 filesystem.

Could this patch be officially backported to 2.4 to allow the use of
the flexible commit interval in noflushd ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 4/12] tunable ext3 commit interval
  2002-08-11 10:15 ` Vincent Bernat
@ 2002-08-11 10:30   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2002-08-11 10:30 UTC (permalink / raw)
  To: Vincent Bernat; +Cc: lkml, noflushd-devel, sct

Vincent Bernat wrote:
> 
> OoO En cette nuit striée d'éclairs du samedi 10 août 2002, vers 02:56,
> Andrew Morton <akpm@zip.com.au> disait:
> 
> > The patch from Stephen Tweedie allows users to modify the journal
> > commit interval for the ext3 filesystem.
> 
> Could this patch be officially backported to 2.4 to allow the use of
> the flexible commit interval in noflushd ?

It's in the 2.4 devel tree, so it will appear in 2.4.20-pre sometime.



-------- Original Message --------
Subject: [gkernel-commit] CVS: ext3/fs/ext3 super.c,1.34.2.21,1.34.2.22
Date: Mon, 29 Jul 2002 14:31:41 -0700
From: "Stephen C. Tweedie" <sct@users.sourceforge.net>
To: gkernel-commit@lists.sourceforge.net

Update of /cvsroot/gkernel/ext3/fs/ext3
In directory usw-pr-cvs1:/tmp/cvs-serv7665

Modified Files:
      Tag: ext3-1_0-branch
	super.c 
Log Message:
Allow an arbitrary commit interval to be set when mounting or remounting
a filesystem.

Note that if this is greater than the system bdflush interval, then the
regular sync()s will beat the commit timer and you won't get longer
commit timeouts.


Index: super.c
===================================================================
RCS file: /cvsroot/gkernel/ext3/fs/ext3/super.c,v
retrieving revision 1.34.2.21
retrieving revision 1.34.2.22
diff -u -r1.34.2.21 -r1.34.2.22
--- super.c	15 Apr 2002 20:34:54 -0000	1.34.2.21
+++ super.c	29 Jul 2002 21:31:38 -0000	1.34.2.22
@@ -646,6 +646,11 @@
 				*mount_options &= ~EXT3_MOUNT_DATA_FLAGS;
 				*mount_options |= data_opt;
 			}
+		} else if (!strcmp (this_char, "commit")) {
+			unsigned long v;
+			if (want_numeric(value, "commit", &v))
+				return 0;
+			sbi->s_commit_interval = (HZ * v);
 		} else {
 			printk (KERN_ERR 
 				"EXT3-fs: Unrecognized mount option %s\n",
@@ -1229,6 +1234,22 @@
 	return NULL;
 }
 
+/*
+ * Setup any per-fs journal parameters now.  We'll do this both on
+ * initial mount, once the journal has been initialised but before we've
+ * done any recovery; and again on any subsequent remount. 
+ */
+static void ext3_init_journal_params(struct ext3_sb_info *sbi, 
+				     journal_t *journal)
+{
+	if (sbi->s_commit_interval)
+		journal->j_commit_interval = sbi->s_commit_interval;
+	/* We could also set up an ext3-specific default for the commit
+	 * interval here, but for now we'll just fall back to the jbd
+	 * default. */
+}
+
+
 static journal_t *ext3_get_journal(struct super_block *sb, int journal_inum)
 {
 	struct inode *journal_inode;
@@ -1263,7 +1284,7 @@
 		printk(KERN_ERR "EXT3-fs: Could not load journal inode\n");
 		iput(journal_inode);
 	}
-	
+	ext3_init_journal_params(EXT3_SB(sb), journal);
 	return journal;
 }
 
@@ -1341,6 +1362,7 @@
 		goto out_journal;
 	}
 	EXT3_SB(sb)->journal_bdev = bdev;
+	ext3_init_journal_params(EXT3_SB(sb), journal);
 	return journal;
 out_journal:
 	journal_destroy(journal);
@@ -1638,6 +1660,8 @@
 
 	es = sbi->s_es;
 
+	ext3_init_journal_params(sbi, sbi->s_journal);
+	
 	if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) {
 		if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
 			return -EROFS;



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
Gkernel-commit mailing list
Gkernel-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gkernel-commit

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-11 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-10  0:56 [patch 4/12] tunable ext3 commit interval Andrew Morton
2002-08-11 10:15 ` Vincent Bernat
2002-08-11 10:30   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox