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

login
register
mail settings
Submitter Zheng Liu
Date Dec. 24, 2012, 7:55 a.m.
Message ID <1356335742-11793-10-git-send-email-wenqing.lz@taobao.com>
Download mbox | patch
Permalink /patch/208039/
State Superseded
Headers show

Comments

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(-)

Patch

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) &&
+	    EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
+		set_opt(sb, DIOREAD_NOLOCK);
+
+	/*
 	 * set default s_li_wait_mult for lazyinit, for the case there is
 	 * no mount option specified.
 	 */