diff options
author | Kevin Jin <[email protected]> | 2023-03-28 11:43:41 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2023-03-28 08:43:41 -0700 |
commit | 65d10bd87c408bfa13fa27bb6ad3ecc0e2e3775b (patch) | |
tree | a72b4dacc9cbd58560e193743a651334adc6a5fb /include | |
parent | 64bfa6bae3dd44bc93b1e9141b746231796a42de (diff) |
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 <[email protected]>
Signed-off-by: jxdking <[email protected]>
Issue #8993
Closes #12194
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/vdev_impl.h | 1 | ||||
-rw-r--r-- | include/sys/vdev_trim.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/include/sys/vdev_impl.h b/include/sys/vdev_impl.h index 73c0206ef..7cfffe3b4 100644 --- a/include/sys/vdev_impl.h +++ b/include/sys/vdev_impl.h @@ -329,6 +329,7 @@ struct vdev { list_node_t vdev_trim_node; kmutex_t vdev_autotrim_lock; kcondvar_t vdev_autotrim_cv; + kcondvar_t vdev_autotrim_kick_cv; kthread_t *vdev_autotrim_thread; /* Protects vdev_trim_thread and vdev_trim_state. */ kmutex_t vdev_trim_lock; diff --git a/include/sys/vdev_trim.h b/include/sys/vdev_trim.h index 2a217f0d4..7a94d4af0 100644 --- a/include/sys/vdev_trim.h +++ b/include/sys/vdev_trim.h @@ -41,6 +41,7 @@ extern void vdev_trim_stop_all(vdev_t *vd, vdev_trim_state_t tgt_state); extern void vdev_trim_stop_wait(spa_t *spa, list_t *vd_list); extern void vdev_trim_restart(vdev_t *vd); extern void vdev_autotrim(spa_t *spa); +extern void vdev_autotrim_kick(spa_t *spa); extern void vdev_autotrim_stop_all(spa_t *spa); extern void vdev_autotrim_stop_wait(vdev_t *vd); extern void vdev_autotrim_restart(spa_t *spa); |