[RFC,9/9,v1] ext4: set dioread_nolock by default for extent-based files

Message ID 1356335742-11793-10-git-send-email-wenqing.lz@taobao.com
State Superseded, archived
Headers show

Commit Message

Zheng Liu Dec. 24, 2012, 7:55 a.m.
From: Zheng Liu <wenqing.lz@taobao.com>

After a dio improvement had been done, we can try to set dioread_nolock by
default for extent-based files when block size is not smaller than page size.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
 Documentation/filesystems/ext4.txt | 5 ++---
 fs/ext4/super.c                    | 8 ++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)


diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 34ea4f1..b377a1e 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -368,9 +368,8 @@  dioread_nolock		locking. If the dioread_nolock option is specified
 			speed storages. However this does not work with
 			data journaling and dioread_nolock option will be
 			ignored with kernel warning. Note that dioread_nolock
-			code path is only used for extent-based files.
-			Because of the restrictions this options comprises
-			it is off by default (e.g. dioread_lock).
+			code path is only used for extent-based files.  it is
+			on by default for extent-based files.
 max_dir_size_kb=n	This limits the size of directories so that any
 			attempt to expand them beyond the specified
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3cdb0a2..e6def09 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3402,6 +3402,14 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		set_opt(sb, DELALLOC);
+	 * enable dioread_nolock by default
+	 * Use -o dioread_lock to turn it off
+	 */
+	if (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb) &&
+		set_opt(sb, DIOREAD_NOLOCK);
+	/*
 	 * set default s_li_wait_mult for lazyinit, for the case there is
 	 * no mount option specified.