Skip to content

Commit

Permalink
scsi/098: Test F2FS write hint support
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanassche committed Jan 9, 2024
1 parent b4413ea commit 4760880
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tests/scsi/098
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/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 write hint support"
QUICK=1

requires() {
_have_fio
_have_driver f2fs
_have_program mkfs.f2fs
_have_module scsi_debug
}

test() {
echo "Running ${TEST_NAME}"

local mount_dir="$TMPDIR/mnt"

local scsi_debug_params=(
delay=0
dev_size_mb=1024
sector_size=4096
)
_init_scsi_debug "${scsi_debug_params[@]}" &&
local dev="/dev/${SCSI_DEBUG_DEVICES[0]}" fail &&
ls -ld "${dev}" >>"${FULL}" &&
mkfs.f2fs "${dev}" >>"${FULL}" 2>&1 &&
mkdir -p "${mount_dir}" &&
mount -t f2fs -o whint_mode=fs-based "${dev}" "${mount_dir}" &&
local fio_args=(
--size=1M
--directory="${mount_dir}"
--time_based
--runtime=10
) &&
_run_fio_verify_io "${fio_args[@]}" >>"${FULL}" 2>&1 ||
fail=true

umount "${mount_dir}" >>"${FULL}" 2>&1
head -n 999 /sys/bus/pseudo/drivers/scsi_debug/group_number_stats >> "${FULL}"
while read -r group count; do
if [ "$count" -gt 0 ]; then echo "$group"; fi
done < /sys/bus/pseudo/drivers/scsi_debug/group_number_stats
_exit_scsi_debug

if [ -z "$fail" ]; then
echo "Test complete"
else
echo "Test failed"
return 1
fi
}
5 changes: 5 additions & 0 deletions tests/scsi/098.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Running scsi/098
0
2
3
Test complete

0 comments on commit 4760880

Please sign in to comment.