2aacef
From 9ffd83c333bdc7741bfa1a73b3461f1b51208c5f Mon Sep 17 00:00:00 2001
aa0848
From: Lukas Nykryn <lnykryn@redhat.com>
aa0848
Date: Tue, 12 Feb 2019 16:58:16 +0100
aa0848
Subject: [PATCH] rules: add elevator= kernel command line parameter
aa0848
aa0848
Kernel removed the elevator= option, so let's reintroduce
aa0848
it for rhel8 via udev rule.
aa0848
aa0848
RHEL-only
aa0848
2aacef
Related: #2138081
aa0848
---
aa0848
 rules.d/40-elevator.rules | 20 ++++++++++++++++++++
2aacef
 rules.d/meson.build       |  3 ++-
2aacef
 2 files changed, 22 insertions(+), 1 deletion(-)
aa0848
 create mode 100644 rules.d/40-elevator.rules
aa0848
aa0848
diff --git a/rules.d/40-elevator.rules b/rules.d/40-elevator.rules
aa0848
new file mode 100644
aa0848
index 0000000000..dbe8fc81a4
aa0848
--- /dev/null
aa0848
+++ b/rules.d/40-elevator.rules
aa0848
@@ -0,0 +1,20 @@
aa0848
+# We aren't adding devices skip the elevator check
aa0848
+ACTION!="add", GOTO="sched_out"
aa0848
+
aa0848
+SUBSYSTEM!="block", GOTO="sched_out"
aa0848
+ENV{DEVTYPE}!="disk", GOTO="sched_out"
aa0848
+
aa0848
+# Technically, dm-multipath can be configured to use an I/O scheduler.
aa0848
+# However, there are races between the 'add' uevent and the linking in
aa0848
+# of the queue/scheduler sysfs file.  For now, just skip dm- devices.
aa0848
+KERNEL=="dm-*|md*", GOTO="sched_out"
aa0848
+
aa0848
+# Skip bio-based devices, which don't support an I/O scheduler.
aa0848
+ATTR{queue/scheduler}=="none", GOTO="sched_out"
aa0848
+
aa0848
+# If elevator= is specified on the kernel command line, change the
aa0848
+# scheduler to the one specified.
aa0848
+IMPORT{cmdline}="elevator"
aa0848
+ENV{elevator}!="", ATTR{queue/scheduler}="$env{elevator}"
aa0848
+
aa0848
+LABEL="sched_out"
aa0848
\ No newline at end of file
aa0848
diff --git a/rules.d/meson.build b/rules.d/meson.build
2aacef
index 70f48e877b..4e88400d02 100644
aa0848
--- a/rules.d/meson.build
aa0848
+++ b/rules.d/meson.build
2aacef
@@ -5,7 +5,8 @@ install_data(
aa0848
         install_dir : udevrulesdir)
aa0848
 
2aacef
 rules = [
2aacef
-        [files('40-redhat.rules',
2aacef
+        [files('40-elevator.rules',
2aacef
+               '40-redhat.rules',
2aacef
                '60-autosuspend.rules',
2aacef
                '60-block.rules',
2aacef
                '60-cdrom_id.rules',