Skip to content

Commit

Permalink
Propagate extent_bytes change to autotrim thread
Browse files Browse the repository at this point in the history
The autotrim thread only reads zfs_trim_extent_bytes_min and
zfs_trim_extent_bytes_max variable only on thread start.  We
should check for parameter changes during thread execution to
allow parameter changes take effect without needing to disable
then restart the autotrim.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Václav Skála <[email protected]>
Closes openzfs#14077
  • Loading branch information
vaclavskala authored and shodanshok committed Nov 3, 2022
1 parent 5f4fff4 commit bf507d0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions module/zfs/vdev_trim.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,12 +1188,11 @@ vdev_autotrim_thread(void *arg)
mutex_exit(&vd->vdev_autotrim_lock);
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);

uint64_t extent_bytes_max = zfs_trim_extent_bytes_max;
uint64_t extent_bytes_min = zfs_trim_extent_bytes_min;

while (!vdev_autotrim_should_stop(vd)) {
int txgs_per_trim = MAX(zfs_trim_txg_batch, 1);
boolean_t issued_trim = B_FALSE;
uint64_t extent_bytes_max = zfs_trim_extent_bytes_max;
uint64_t extent_bytes_min = zfs_trim_extent_bytes_min;

/*
* All of the metaslabs are divided in to groups of size
Expand Down

0 comments on commit bf507d0

Please sign in to comment.