verify_runnable "both"
-# See issue: https://github.com/zfsonlinux/zfs/issues/5479
-if is_kmemleak; then
- log_unsupported "Test case runs slowly when kmemleak is enabled"
-fi
-
function cleanup
{
datasetexists $TEST_FS && log_must zfs destroy $TEST_FS
+ log_must set_tunable64 zfs_async_block_max_blocks 100000
}
log_onexit cleanup
log_assert "async_destroy can suspend and resume traversal"
-log_must zfs create -o recordsize=512 -o compression=off $TEST_FS
+log_must zfs create -o recordsize=1k -o compression=off $TEST_FS
+
+# Fill with 128,000 blocks.
+log_must dd bs=1024k count=128 if=/dev/zero of=/$TEST_FS/file
-# Fill with 1G
-log_must dd bs=1024k count=1024 if=/dev/zero of=/$TEST_FS/file
+#
+# Decrease the max blocks to free each txg, so that freeing takes
+# long enough that we can observe it.
+#
+log_must set_tunable64 zfs_async_block_max_blocks 100
+log_must sync
log_must zfs destroy $TEST_FS
#
# We monitor the freeing property, to verify we can see blocks being
-# freed while the suspend/resume code is exerciesd.
+# freed while the suspend/resume code is exercised.
#
t0=$SECONDS
count=0
[[ $count -eq 0 ]] && log_fail "Freeing property remained empty"
+#
+# After a bit, go back to allowing an unlimited amount of freeing
+# per txg.
+#
+sleep 10
+log_must set_tunable64 zfs_async_block_max_blocks 100000
+
# Wait for everything to be freed.
while [[ "0" != "$(zpool list -Ho freeing $TESTPOOL)" ]]; do
[[ $((SECONDS - t0)) -gt 180 ]] && \