From 6e83ef2c8d4afad07921f2aff26c7be74d14dc9f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 19 Mar 2024 09:49:23 -0700 Subject: [PATCH] zbd/091: Test F2FS REQ_FUA support for zoned block devices --- tests/zbd/091 | 81 +++++++++++++++++++++++++++++++++++++++++++++++ tests/zbd/091.out | 2 ++ 2 files changed, 83 insertions(+) create mode 100755 tests/zbd/091 create mode 100644 tests/zbd/091.out diff --git a/tests/zbd/091 b/tests/zbd/091 new file mode 100755 index 00000000..6a444914 --- /dev/null +++ b/tests/zbd/091 @@ -0,0 +1,81 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2022 Google LLC + +. tests/zbd/rc +. common/null_blk +. common/scsi_debug + +DESCRIPTION="test F2FS REQ_FUA support for zoned block devices" +QUICK=1 + +requires() { + _have_fio + _have_driver f2fs + _have_module null_blk + _have_program mkfs.f2fs +} + +test() { + echo "Running ${TEST_NAME}" + + local mount_dir="$TMPDIR/mnt" + + _init_null_blk nr_devices=0 queue_mode=2 && + local null_blk_params=( + blocksize=4096 + completion_nsec=0 + memory_backed=1 + size=1024 # MB + submit_queues=1 + power=1 + ) && + _configure_null_blk nullb0 "${null_blk_params[@]}" && + local cdev=/dev/nullb0 && + local null_blk_params=( + blocksize=4096 + completion_nsec=0 + memory_backed=1 + size=1024 # MB + submit_queues=1 + zoned=1 + zone_size=4 # MB + power=1 + ) && + _configure_null_blk nullb1 "${null_blk_params[@]}" && + echo mq-deadline >/sys/class/block/nullb1/queue/scheduler && + local zdev=/dev/nullb1 && + ls -ld "${cdev}" "${zdev}" >>"${FULL}" 2>&1 && + mkfs.f2fs -m "${cdev}" -c "${zdev}" >>"${FULL}" 2>&1 && + mkdir -p "${mount_dir}" && + mount -t f2fs "${cdev}" "${mount_dir}" && + { echo 0x3f > "/sys/fs/f2fs/${cdev#/dev/}/data_io_flag"; } >> "${FULL}" 2>&1 && # REQ_META | REQ_FUA + grep -aH . "/sys/fs/f2fs/${cdev#/dev/}/data_io_flag" >>"${FULL}" 2>&1 && + local fio_args=( + --directory="${mount_dir}" + --group_reporting=1 + --gtod_reduce=1 + --ioengine=io_uring + --norandommap + --name=f2fs-fua + --numjob=4 + --runtime=30 + --rw=randwrite + --size=4M + --thread + --time_based + ) && + _run_fio "${fio_args[@]}" >>"${FULL}" 2>&1 || + fail=true + + umount "${mount_dir}" >>"${FULL}" 2>&1 + _exit_scsi_debug + _exit_null_blk + + if [ -z "$fail" ]; then + echo "Test complete" + else + echo "Test failed" + return 1 + fi +} diff --git a/tests/zbd/091.out b/tests/zbd/091.out new file mode 100644 index 00000000..e1e6844a --- /dev/null +++ b/tests/zbd/091.out @@ -0,0 +1,2 @@ +Running zbd/091 +Test complete