mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +03:00
zvol: Enable zvol threading functionality on FreeBSD
Make zvol I/O requests processing asynchronous on FreeBSD side in some cases. Clone zvol threading logic and required module parameters from Linux side. Make zvol threadpool creation/destruction logic shared for both Linux and FreeBSD. The IO requests are processed asynchronously in next cases: - volmode=geom: if IO request thread is geom thread or cannot sleep. - volmode=cdev: if IO request passed thru struct cdevsw .d_strategy routine, mean is AIO request. In all other cases the IO requests are processed synchronously. The volthreading zvol property is ignored on FreeBSD side. Sponsored-by: vStack, Inc. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: @ImAwsumm Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com> Closes #17169
This commit is contained in:
@@ -3386,17 +3386,21 @@ function set_tunable_impl
|
||||
|
||||
function save_tunable
|
||||
{
|
||||
[[ ! -d $TEST_BASE_DIR ]] && return 1
|
||||
[[ -e $TEST_BASE_DIR/tunable-$1 ]] && return 2
|
||||
echo "$(get_tunable """$1""")" > "$TEST_BASE_DIR"/tunable-"$1"
|
||||
if tunable_exists $1 ; then
|
||||
[[ ! -d $TEST_BASE_DIR ]] && return 1
|
||||
[[ -e $TEST_BASE_DIR/tunable-$1 ]] && return 2
|
||||
echo "$(get_tunable """$1""")" > "$TEST_BASE_DIR"/tunable-"$1"
|
||||
fi
|
||||
}
|
||||
|
||||
function restore_tunable
|
||||
{
|
||||
[[ ! -e $TEST_BASE_DIR/tunable-$1 ]] && return 1
|
||||
val="$(cat $TEST_BASE_DIR/tunable-"""$1""")"
|
||||
set_tunable64 "$1" "$val"
|
||||
rm $TEST_BASE_DIR/tunable-$1
|
||||
if tunable_exists $1 ; then
|
||||
[[ ! -e $TEST_BASE_DIR/tunable-$1 ]] && return 1
|
||||
val="$(cat $TEST_BASE_DIR/tunable-"""$1""")"
|
||||
set_tunable64 "$1" "$val"
|
||||
rm $TEST_BASE_DIR/tunable-$1
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
@@ -102,6 +102,7 @@ VDEV_VALIDATE_SKIP vdev.validate_skip vdev_validate_skip
|
||||
VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
|
||||
VOL_MODE vol.mode zvol_volmode
|
||||
VOL_RECURSIVE vol.recursive UNSUPPORTED
|
||||
VOL_REQUEST_SYNC zvol_request_sync zvol_request_sync
|
||||
VOL_USE_BLK_MQ UNSUPPORTED zvol_use_blk_mq
|
||||
BCLONE_ENABLED bclone_enabled zfs_bclone_enabled
|
||||
BCLONE_WAIT_DIRTY bclone_wait_dirty zfs_bclone_wait_dirty
|
||||
|
||||
@@ -140,3 +140,11 @@ function set_blk_mq
|
||||
log_must set_tunable32 VOL_USE_BLK_MQ $1
|
||||
fi
|
||||
}
|
||||
|
||||
# enable/disable zvol sync mode
|
||||
#
|
||||
# $1: 1 = enable, 0 = disable
|
||||
function set_zvol_sync
|
||||
{
|
||||
log_must set_tunable32 VOL_REQUEST_SYNC $1
|
||||
}
|
||||
|
||||
@@ -60,6 +60,9 @@ typeset -f each_zvol_size=$(( floor($biggest_zvol_size_possible * 0.9 / \
|
||||
|
||||
typeset tmpdir="$(mktemp -t -d zvol_stress_fio_state.XXXXXX)"
|
||||
|
||||
log_must save_tunable VOL_USE_BLK_MQ
|
||||
log_must save_tunable VOL_REQUEST_SYNC
|
||||
|
||||
function create_zvols
|
||||
{
|
||||
log_note "Creating $num_zvols zvols that are ${each_zvol_size}B each"
|
||||
@@ -124,7 +127,8 @@ function cleanup
|
||||
log_must zinject -c all
|
||||
log_must zpool clear $TESTPOOL
|
||||
destroy_zvols
|
||||
set_blk_mq 0
|
||||
log_must restore_tunable VOL_USE_BLK_MQ
|
||||
log_must restore_tunable VOL_REQUEST_SYNC
|
||||
|
||||
# Remove all fio's leftover state files
|
||||
if [ -n "$tmpdir" ] ; then
|
||||
@@ -146,6 +150,18 @@ destroy_zvols
|
||||
set_blk_mq 1
|
||||
create_zvols
|
||||
do_zvol_stress
|
||||
destroy_zvols
|
||||
|
||||
# Disable zvol sync mode, and re-run test
|
||||
set_zvol_sync 0
|
||||
create_zvols
|
||||
do_zvol_stress
|
||||
destroy_zvols
|
||||
|
||||
# Same for enabled zvol sync mode
|
||||
set_zvol_sync 1
|
||||
create_zvols
|
||||
do_zvol_stress
|
||||
|
||||
# Inject some errors, and verify we see some IO errors in zpool status
|
||||
sync_pool $TESTPOOL
|
||||
|
||||
Reference in New Issue
Block a user