]> www.infradead.org Git - users/hch/blktests.git/commitdiff
common/cpuhotplug: fix ALL_CPUS
authorOmar Sandoval <osandov@fb.com>
Fri, 19 Jun 2020 21:15:42 +0000 (14:15 -0700)
committerOmar Sandoval <osandov@fb.com>
Fri, 19 Jun 2020 21:15:42 +0000 (14:15 -0700)
_have_cpu_hotplug needs to set cpu before adding it to ALL_CPUS.

Closes #68.

common/cpuhotplug

index d5b43bdf7dbab04f09f44307b770831082b509cf..d3aabfa75831eee8ba29b5eb0912569168154971 100644 (file)
@@ -14,9 +14,9 @@ _have_cpu_hotplug() {
 
        local cpu_dir cpu
        for cpu_dir in /sys/devices/system/cpu/cpu+([0-9]); do
+               cpu="${cpu_dir#/sys/devices/system/cpu/cpu}"
                ALL_CPUS+=("$cpu")
                if [[ -w ${cpu_dir}/online ]]; then
-                       cpu="${cpu_dir#/sys/devices/system/cpu/cpu}"
                        HOTPLUGGABLE_CPUS+=("$cpu")
                        # shellcheck disable=SC2034
                        CPUS_ONLINE_SAVED["$cpu"]="$(cat "${cpu_dir}/online")"