ext4: Module parameter to disable discard mount param on ploop

Submitted by Kirill Tkhai on April 26, 2019, 3:45 p.m.

Details

Message ID 155629352502.1612.15526286687941720090.stgit@localhost.localdomain
State New
Series "ext4: Module parameter to disable discard mount param on ploop"
Headers show

Commit Message

Kirill Tkhai April 26, 2019, 3:45 p.m.
This is needed to measure performance in standard way.

https://jira.sw.ru/browse/PSBM-94181

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/ext4/super.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 623540274705..7f00f804cdba 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -117,6 +117,9 @@  MODULE_ALIAS("ext3");
 #define IS_EXT3_SB(sb) (0)
 #endif
 
+ushort ext4_force_discard_on_ploop = 1;
+module_param_named(force_discard_on_ploop, ext4_force_discard_on_ploop, ushort, 0644);
+
 static int ext4_verify_csum_type(struct super_block *sb,
 				 struct ext4_super_block *es)
 {
@@ -3974,7 +3977,7 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		set_opt(sb, ERRORS_RO);
 	if (def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY)
 		set_opt(sb, BLOCK_VALIDITY);
-	if (def_mount_opts & EXT4_DEFM_DISCARD || is_ploop(sb))
+	if (def_mount_opts & EXT4_DEFM_DISCARD || (is_ploop(sb) && ext4_force_discard_on_ploop))
 		set_opt(sb, DISCARD);
 
 	sbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid));