Defer resilver only when progress is above a threshold

Restart a resilver from scratch, if the current one in progress is
below a new tunable, zfs_resilver_defer_percent (defaulting to 10%).

The original rationale for deferring additional resilvers, when there is
already one in progress, was to help achieving data redundancy sooner
for the data that gets scanned at the end of the resilver.

But in case the admin wants to attach multiple disks to a single vdev,
it wasn't immediately obvious the admin is supposed to run
`zpool resilver` afterwards to reset the deferred resilvers and start
a new one from scratch.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
Closes #15810
This commit is contained in:
Pavel Snajdr
2024-10-04 19:41:17 +02:00
committed by GitHub
parent 3d0175d10e
commit 0d77e738e6
4 changed files with 62 additions and 20 deletions
@@ -96,6 +96,8 @@ set -A RESTARTS -- '1' '2' '2' '2'
set -A VDEVS -- '' '' '' ''
set -A DEFER_RESTARTS -- '1' '1' '1' '2'
set -A DEFER_VDEVS -- '-' '2' '2' '-'
set -A EARLY_RESTART_DEFER_RESTARTS -- '1' '2' '2' '2'
set -A EARLY_RESTART_DEFER_VDEVS -- '' '' '' ''
VDEV_REPLACE="${VDEV_FILES[1]} $SPARE_VDEV_FILE"
@@ -125,7 +127,7 @@ done
wait
# test without and with deferred resilve feature enabled
for test in "without" "with"
for test in "without" "with" "with_early_restart"
do
log_note "Testing $test deferred resilvers"
@@ -135,6 +137,13 @@ do
RESTARTS=( "${DEFER_RESTARTS[@]}" )
VDEVS=( "${DEFER_VDEVS[@]}" )
VDEV_REPLACE="$SPARE_VDEV_FILE ${VDEV_FILES[1]}"
log_must set_tunable32 RESILVER_DEFER_PERCENT 0
elif [[ $test == "with_early_restart" ]]
then
RESTARTS=( "${EARLY_RESTART_DEFER_RESTARTS[@]}" )
VDEVS=( "${EARLY_RESTART_DEFER_VDEVS[@]}" )
VDEV_REPLACE="${VDEV_FILES[1]} $SPARE_VDEV_FILE"
log_must set_tunable32 RESILVER_DEFER_PERCENT 100
fi
# clear the events