linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 2/2] ext4: Automatically enable journal_async_commit on ext4 file systems
Date: Sat,  5 Sep 2009 18:32:43 -0400	[thread overview]
Message-ID: <1252189963-23868-2-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1252189963-23868-1-git-send-email-tytso@mit.edu>

Now that we have cleaned up journal_async_commit, it's safe to enable
it all the time.  But we only want to do so if ext4-specific INCOMPAT
features are enabled, since otherwise we will prevent the filesystem
from being mounted using ext3.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 Documentation/filesystems/ext4.txt |    8 ++++++--
 fs/ext4/super.c                    |   26 ++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 3e329db..4f8d73a 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -135,8 +135,12 @@ ro                   	Mount filesystem read only. Note that ext4 will
 		     	writes to the filesystem.
 
 journal_async_commit	Commit block can be written to disk without waiting
-			for descriptor blocks. If enabled older kernels cannot
-			mount the device.
+			for descriptor blocks.  This mount option will be 
+			automatically enabled if ext4-specific INCOMPAT
+			features are present in the file system.
+
+nojournal_async_commit	Disable the journal_async_commit option, even
+			for ext4 filesystems.
 
 journal=update		Update the ext4 file system's journal to the current
 			format.
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index f1815d3..f644a5c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -75,6 +75,15 @@ static int ext4_unfreeze(struct super_block *sb);
 static void ext4_write_super(struct super_block *sb);
 static int ext4_freeze(struct super_block *sb);
 
+/*
+ * If ext4 filesystem features are enabled, then enable async_commits
+ * by default.
+ */
+#define ASYNC_COMMIT_DEFAULT(sb) (EXT4_HAS_INCOMPAT_FEATURE(sb, \
+					(EXT4_FEATURE_INCOMPAT_EXTENTS| \
+					 EXT4_FEATURE_INCOMPAT_64BIT| \
+					 EXT4_FEATURE_INCOMPAT_FLEX_BG)))
+
 
 ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
 			       struct ext4_group_desc *bg)
@@ -845,8 +854,13 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
 	 */
 	seq_puts(seq, ",barrier=");
 	seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0");
-	if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
-		seq_puts(seq, ",journal_async_commit");
+	if (ASYNC_COMMIT_DEFAULT(sb)) {
+		if (!test_opt(sb, JOURNAL_ASYNC_COMMIT))
+			seq_puts(seq, ",nojournal_async_commit");
+	} else {
+		if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
+			seq_puts(seq, ",journal_async_commit");
+	}
 	if (test_opt(sb, NOBH))
 		seq_puts(seq, ",nobh");
 	if (test_opt(sb, I_VERSION))
@@ -1050,6 +1064,7 @@ enum {
 	Opt_commit, Opt_min_batch_time, Opt_max_batch_time,
 	Opt_journal_update, Opt_journal_dev,
 	Opt_journal_checksum, Opt_journal_async_commit,
+	Opt_nojournal_async_commit,
 	Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
 	Opt_data_err_abort, Opt_data_err_ignore, Opt_mb_history_length,
 	Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
@@ -1092,6 +1107,7 @@ static const match_table_t tokens = {
 	{Opt_journal_dev, "journal_dev=%u"},
 	{Opt_journal_checksum, "journal_checksum"},
 	{Opt_journal_async_commit, "journal_async_commit"},
+	{Opt_nojournal_async_commit, "nojournal_async_commit"},
 	{Opt_abort, "abort"},
 	{Opt_data_journal, "data=journal"},
 	{Opt_data_ordered, "data=ordered"},
@@ -1284,6 +1300,9 @@ static int parse_options(char *options, struct super_block *sb,
 		case Opt_journal_async_commit:
 			set_opt(sbi->s_mount_opt, JOURNAL_ASYNC_COMMIT);
 			break;
+		case Opt_nojournal_async_commit:
+			clear_opt(sbi->s_mount_opt, JOURNAL_ASYNC_COMMIT);
+			break;
 		case Opt_noload:
 			set_opt(sbi->s_mount_opt, NOLOAD);
 			break;
@@ -2422,6 +2441,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	 */
 	set_opt(sbi->s_mount_opt, DELALLOC);
 
+	if (ASYNC_COMMIT_DEFAULT(sb))
+		set_opt(sbi->s_mount_opt, JOURNAL_ASYNC_COMMIT);
+
 	if (!parse_options((char *) data, sb, &journal_devnum,
 			   &journal_ioprio, NULL, 0))
 		goto failed_mount;
-- 
1.6.3.2.1.gb9f7d.dirty


  reply	other threads:[~2009-09-05 22:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-05 22:32 [PATCH 1/2] ext4: Remove journal_checksum mount option and enable it by default Theodore Ts'o
2009-09-05 22:32 ` Theodore Ts'o [this message]
2009-09-05 22:57   ` [PATCH 2/2] ext4: Automatically enable journal_async_commit on ext4 file systems Andreas Dilger
2009-09-06  1:32     ` Theodore Tso
2009-09-06  2:57   ` Eric Sandeen
2009-09-07 23:48     ` Ric Wheeler
2009-09-07 23:42   ` Ric Wheeler
2009-09-08  4:45     ` Theodore Tso
2009-09-08 11:50       ` Ric Wheeler
2009-09-11  2:45         ` Theodore Tso
2009-09-11 11:07           ` Ric Wheeler
2009-09-11 13:13             ` Theodore Tso
2009-09-11 14:39               ` Ric Wheeler

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=1252189963-23868-2-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    /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).