diff options
author | Yang Xu <xuyang2018.jy@fujitsu.com> | 2022-01-27 17:11:35 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-02-23 11:58:38 +0100 |
commit | 2eed1b06f0abf00916ceb6ce61e4605928cec762 (patch) | |
tree | 04aca988e4a15de8f81460c72d6fda9fef8d38b5 /tools | |
parent | 6312f6a53fd3ea38125dcaca5e3c9aa7d8a60cf7 (diff) | |
download | linux-stable-2eed1b06f0abf00916ceb6ce61e4605928cec762.tar.gz linux-stable-2eed1b06f0abf00916ceb6ce61e4605928cec762.tar.bz2 linux-stable-2eed1b06f0abf00916ceb6ce61e4605928cec762.zip |
selftests/zram: Skip max_comp_streams interface on newer kernel
[ Upstream commit fc4eb486a59d70bd35cf1209f0e68c2d8b979193 ]
Since commit 43209ea2d17a ("zram: remove max_comp_streams internals"), zram
has switched to per-cpu streams. Even kernel still keep this interface for
some reasons, but writing to max_comp_stream doesn't take any effect. So
skip it on newer kernel ie 4.7.
The code that comparing kernel version is from xfstests testsuite ext4/053.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/selftests/zram/zram_lib.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh index 9e73a4fb9b0a..2c1d1c567f85 100755 --- a/tools/testing/selftests/zram/zram_lib.sh +++ b/tools/testing/selftests/zram/zram_lib.sh @@ -20,6 +20,9 @@ dev_mounted=-1 # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 +kernel_version=`uname -r | cut -d'.' -f1,2` +kernel_major=${kernel_version%.*} +kernel_minor=${kernel_version#*.} trap INT @@ -34,6 +37,20 @@ check_prereqs() fi } +kernel_gte() +{ + major=${1%.*} + minor=${1#*.} + + if [ $kernel_major -gt $major ]; then + return 0 + elif [[ $kernel_major -eq $major && $kernel_minor -ge $minor ]]; then + return 0 + fi + + return 1 +} + zram_cleanup() { echo "zram cleanup" @@ -95,6 +112,13 @@ zram_max_streams() { echo "set max_comp_streams to zram device(s)" + kernel_gte 4.7 + if [ $? -eq 0 ]; then + echo "The device attribute max_comp_streams was"\ + "deprecated in 4.7" + return 0 + fi + local i=0 for max_s in $zram_max_streams; do local sys_path="/sys/block/zram${i}/max_comp_streams" |