[RHEL7,COMMIT] fs/ext4: Make "lazytime" mount option by default

Submitted by Vasily Averin on March 3, 2021, 4:43 p.m.

Details

Message ID 202103031643.123GhqqM015182@vz7build.vvs.sw.ru
State New
Series "fs/ext4: Make "lazytime" mount option by default"
Headers show

Commit Message

Vasily Averin March 3, 2021, 4:43 p.m.
The commit is pushed to "branch-rh7-3.10.0-1160.15.2.vz7.173.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.15.2.vz7.173.3
------>
commit f198023f31c6791ac76670be7700b3ebe8362f4d
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date:   Wed Mar 3 19:43:52 2021 +0300

    fs/ext4: Make "lazytime" mount option by default
    
    "lazytime" mount option significantly decreases the number of metadata
    updates thus decreasing amount of random i/o.
    
    We definitely want this option to be enabled for all ploop mounts as
    well as for filesystems underlying under ploop images (e.g. /vz).
    
    So the only filesystems which we don't care "lazytime" presense are
    "/", "/boot", etc.
    
    But even for them the option should not hurt, so let's just enable
    the option by default for all ext4 mounts.
    
    To disable "lazytime" option use "-o nolazytime" mount option.
    
    https://jira.sw.ru/browse/PSBM-106544
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 fs/ext4/super.c | 7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ab2abc1..8105567 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4069,6 +4069,13 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		set_opt(sb, DELALLOC);
 
 	/*
+	 * enable "lazytime" mount option for all ext4 mounts by default
+	 * Use -o nolazytime to turn it off
+	 */
+	if (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb))
+		sb->s_flags |= MS_LAZYTIME;
+
+	/*
 	 * set default s_li_wait_mult for lazyinit, for the case there is
 	 * no mount option specified.
 	 */