3 # Copyright (C) 2018 Western Digital Corporation or its affiliates.
5 # This file is released under the GPL.
7 scriptdir="$(cd "$(dirname "$0")" && pwd)"
11 if [[ ${1} == "-h" ]]; then
12 echo "Usage: ${0} [OPTIONS]"
14 echo -e "\t-h Show this message."
15 echo -e "\t-zone-cap Use null blk with zone capacity less than zone size."
16 echo -e "\tany option supported by test-zbd-support script."
18 elif [[ ${1} == "-zone-cap" ]]; then
24 for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done
26 modprobe null_blk nr_devices=0 || exit $?
27 for d in /sys/kernel/config/nullb/*; do
28 [ -d "$d" ] && rmdir "$d"
31 [ -e /sys/module/null_blk ] && exit $?
32 modprobe null_blk nr_devices=0 &&
33 cd /sys/kernel/config/nullb &&
37 if ((zone_capacity < zone_size)); then
38 if [[ ! -w zone_capacity ]]; then
39 echo "null blk does not support zone capacity"
42 echo "${zone_capacity}" > zone_capacity
46 echo "${zone_size}" > zone_size &&
47 echo 0 > completion_nsec &&
48 echo 4096 > blocksize &&
50 echo 1 > memory_backed &&
51 echo 1 > power || exit $?
53 "${scriptdir}"/test-zbd-support "$@" /dev/nullb0