]> git.proxmox.com Git - mirror_zfs.git/commit
Fix short-lived txg caused by autotrim
authorKevin Jin <33590050+jxdking@users.noreply.github.com>
Tue, 28 Mar 2023 15:43:41 +0000 (11:43 -0400)
committerGitHub <noreply@github.com>
Tue, 28 Mar 2023 15:43:41 +0000 (08:43 -0700)
commit65d10bd87c408bfa13fa27bb6ad3ecc0e2e3775b
treea72b4dacc9cbd58560e193743a651334adc6a5fb
parent64bfa6bae3dd44bc93b1e9141b746231796a42de
Fix short-lived txg caused by autotrim

Current autotrim causes short-lived txg through:

1. calling txg_wait_synced() in metaslab_enable()
2. calling txg_wait_open() with should_quiesce = true

This patch addresses all the issues mentioned above.

A new cv, vdev_autotrim_kick_cv is added to kick autotrim activity.
It will be signaled once a txg is synced so that it does not change
the original autotrim pace. Also because it is a cv, the wait is
interruptible which speeds up the vdev_autotrim_stop_wait() call.

Finally, combining big zfs_txg_timeout, txg_wait_open() also causes
delay when exporting a pool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: jxdking <lostking2008@hotmail.com>
Issue #8993
Closes #12194
include/sys/vdev_impl.h
include/sys/vdev_trim.h
module/zfs/spa.c
module/zfs/vdev.c
module/zfs/vdev_trim.c