public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [patch 4/12] tunable ext3 commit interval
Date: Fri, 09 Aug 2002 17:56:47 -0700	[thread overview]
Message-ID: <3D5464CF.DCD510D6@zip.com.au> (raw)



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;

.

             reply	other threads:[~2002-08-10  0:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-10  0:56 Andrew Morton [this message]
2002-08-11 10:15 ` [patch 4/12] tunable ext3 commit interval Vincent Bernat
2002-08-11 10:30   ` Andrew Morton

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=3D5464CF.DCD510D6@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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