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

Submitted by Konstantin Khorenko on March 3, 2021, 1:06 p.m.

Details

Message ID 20210303130604.976-1-khorenko@virtuozzo.com
State New
Series "fs/ext4: Make "lazytime" mount option by default"
Headers show

Commit Message

Konstantin Khorenko March 3, 2021, 1:06 p.m.
"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 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.