[Devel] [PATCH rh7] fs/ext4: Make "lazytime" mount option by default

Konstantin Khorenko khorenko at virtuozzo.com
Wed Mar 3 16:06:04 MSK 2021


"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 at virtuozzo.com>
---
 fs/ext4/super.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ab2abc1b398a..810556737675 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4068,6 +4068,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	    ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0))
 		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.
-- 
2.24.3



More information about the Devel mailing list