152484
From 1e423276a24d7c895d196f9f10bf8c0b9155c633 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
4eda52
Resolves: #2003002
4295f9
---
4295f9
 rules.d/40-elevator.rules | 20 ++++++++++++++++++++
4295f9
 rules.d/meson.build       |  1 +
4295f9
 2 files changed, 21 insertions(+)
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
152484
index c5c3590b29..7e0bd89200 100644
4295f9
--- a/rules.d/meson.build
4295f9
+++ b/rules.d/meson.build
4295f9
@@ -5,6 +5,7 @@ install_data(
4295f9
         install_dir : udevrulesdir)
4295f9
 
4295f9
 rules = files('''
4295f9
+        40-elevator.rules
4295f9
         40-redhat.rules
4295f9
         60-autosuspend.rules
4295f9
         60-block.rules