[Devel] [PATCH RHEL7 COMMIT] ext4: always imply discard mount option if undelying ploop is detected
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Mar 13 17:01:41 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-957.5.1.vz7.84.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.5.1.vz7.84.8
------>
commit 585e2c8522741d3cef6973883553c64059e12618
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date: Wed Mar 13 16:44:40 2019 +0300
ext4: always imply discard mount option if undelying ploop is detected
This is a temporary patch for tesing ploop discard support:
https://pmc.acronis.com/browse/VSTOR-19972
The patch effectively enables automatic discard requests
on all ext4 filesystems over ploop block devices.
Note1: discard feature works in a local case only at the moment.
Note2: pfcache ploop will use discards as well.
Note3: is a ploop is located over pStorage, discard requests
will return errors in ploop internals.
Note4: the patch adds a check for default ploop major (182) only.
If ploop module is loaded with non-default major number,
discard mount options won't be added.
The patch is to be reverted later when userspace is enhanced
to add discard mount options where appropriate.
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
fs/ext4/super.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e607d8b5235f..623540274705 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3808,6 +3808,13 @@ static int ext4_reserve_clusters(struct ext4_sb_info *sbi, ext4_fsblk_t count)
return 0;
}
+#define PLOOP_DEVICE_MAJOR 182
+
+static bool is_ploop(struct super_block *sb)
+{
+ return sb->s_bdev->bd_disk->major == PLOOP_DEVICE_MAJOR;
+}
+
static int ext4_fill_super(struct super_block *sb, void *data, int silent)
{
struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev);
@@ -3967,7 +3974,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)
+ if (def_mount_opts & EXT4_DEFM_DISCARD || is_ploop(sb))
set_opt(sb, DISCARD);
sbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid));
More information about the Devel
mailing list