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