@@ -82,6 +82,17 @@ passing the `-d` command line option or setting the `DEVICE_ONLY` variable.
DEVICE_ONLY=1
```
+### Zoned Block Device
+
+Some test items prepare virtual devices such as null_blk. To configure the
+virtual device as a zoned block device, set `ZONED` variable. The use of the
+ZONED variable requires that the kernel be compiled with CONFIG_BLK_DEV_ZONED
+enabled.
+
+```sh
+ZONED=1
+```
+
### Custom Setup
The `config` file is really just a bash file that is sourced at the beginning
@@ -591,6 +591,7 @@ fi
# Default configuration.
: "${DEVICE_ONLY:=0}"
: "${QUICK_RUN:=0}"
+: "${ZONED:=0}"
: "${OUTPUT:=results}"
if [[ -v EXCLUDE ]] && ! declare -p EXCLUDE | grep -q '^declare -a'; then
# If EXCLUDE was not defined as an array, convert it to one.
@@ -8,8 +8,29 @@ _have_null_blk() {
_have_modules null_blk
}
+_null_blk_not_zoned() {
+ if [[ "${ZONED}" != "0" ]]; then
+ # shellcheck disable=SC2034
+ SKIP_REASON="null_blk zoned mode not supported"
+ return 1
+ fi
+ return 0
+}
+
_init_null_blk() {
- if ! modprobe -r null_blk || ! modprobe null_blk "$@"; then
+ for d in /sys/kernel/config/nullb/*;
+ do [[ -d "$d" ]] && rmdir "$d"; done
+
+ local _zoned=""
+ if [[ ${ZONED} -ne 0 ]] ; then
+ if ! _have_kernel_option BLK_DEV_ZONED ; then
+ echo -n "ZONED specified for kernel with "
+ echo "CONFIG_BLK_DEV_ZONED disabled"
+ return 1
+ fi
+ _zoned="zoned=1"
+ fi
+ if ! modprobe -r null_blk || ! modprobe null_blk "$@" "${_zoned}" ; then
return 1
fi