]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
blktests: split out cgroup2 controller and file check
authorDennis Zhou <dennis@kernel.org>
Thu, 20 Dec 2018 18:18:25 +0000 (12:18 -0600)
committerOmar Sandoval <osandov@fb.com>
Thu, 20 Dec 2018 23:46:16 +0000 (15:46 -0800)
This is a prep patch for a new test that will race blkg association and
request_queue cleanup. As blkg association is a underlying cgroup io
controller feature, we need the ability to check if the controller is
available.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
common/cgroup

index d445093253f9ef427703fb57ece22e9feedc012f..48e546fcc943e188fab84b82d5ea4ef3afe3f457 100644 (file)
@@ -37,19 +37,27 @@ _have_cgroup2()
        return 0
 }
 
-_have_cgroup2_controller_file()
+_have_cgroup2_controller()
 {
-       _have_cgroup2 || return 1
-
        local controller="$1"
-       local file="$2"
-       local dir
+
+       _have_cgroup2 || return 1
 
        dir="$(_cgroup2_base_dir)"
+
        if ! grep -q "$controller" "$dir/cgroup.controllers"; then
                SKIP_REASON="no support for $controller cgroup controller; if it is enabled, you may need to boot with cgroup_no_v1=$controller"
                return 1
        fi
+}
+
+_have_cgroup2_controller_file()
+{
+       local controller="$1"
+       local file="$2"
+       local dir
+
+       _have_cgroup2_controller "$controller" || return 1
 
        mkdir "$dir/blktests"
        echo "+$controller" > "$dir/cgroup.subtree_control"