]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
block/021: test setting 'nr_requests'
authorMing Lei <ming.lei@redhat.com>
Sat, 2 Jun 2018 05:02:04 +0000 (13:02 +0800)
committerOmar Sandoval <osandov@fb.com>
Mon, 11 Jun 2018 20:33:42 +0000 (13:33 -0700)
'nr_requests' can be a bit different for 'none' scheduler,
and especially current blk-mq can only decrease this value
for 'none.'

The patch of 'blk-mq: fix read/write 'nr_requests' in case of 'none' scheduler'
has been sent out for fixing this issue.

Cc: Marco Patalano <mpatalan@redhat.com>
Cc: "Ewan D. Milne" <emilne@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
[Omar: fix description comment, clean up]
Signed-off-by: Omar Sandoval <osandov@fb.com>
tests/block/021 [new file with mode: 0755]
tests/block/021.out [new file with mode: 0755]

diff --git a/tests/block/021 b/tests/block/021
new file mode 100755 (executable)
index 0000000..74fa709
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# Test reading and writing nr_requests with different schedulers. Regression
+# test for 32a50fabb334 ("blk-mq: update nr_requests when switching to 'none'
+# scheduler").
+#
+# Copyright (C) 2018 Ming Lei <ming.lei@redhat.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="read/write nr_requests on null-blk with different schedulers"
+QUICK=1
+
+requires() {
+       _have_module null_blk
+}
+
+test() {
+       echo "Running ${TEST_NAME}"
+
+       modprobe -r null_blk
+       modprobe null_blk
+
+       local max_nr
+       local nr
+       local scheds
+       # shellcheck disable=SC2207
+       scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
+
+       for sched in "${scheds[@]}"; do
+               echo "Testing $sched" >> "$FULL"
+               echo "$sched" > /sys/block/nullb0/queue/scheduler
+               max_nr="$(cat /sys/block/nullb0/queue/nr_requests)"
+               for ((nr = 4; nr <= max_nr; nr++)); do
+                       echo "$nr" > /sys/block/nullb0/queue/nr_requests
+               done
+       done
+
+       modprobe -r null_blk
+
+       echo "Test complete"
+}
diff --git a/tests/block/021.out b/tests/block/021.out
new file mode 100755 (executable)
index 0000000..3a397c5
--- /dev/null
@@ -0,0 +1,2 @@
+Running block/021
+Test complete