我读过了“添加 TRIM 支持”文章,但未能找到“ZFS 何时以及多久autotrim
发生一次?”以及如何观察活动autotrim
?
提前感谢您的评论。
答案1
ZFS 自动修剪实际上是一种在块/范围被释放后运行的连续、机会性操作。
来自手册页:
自动修剪 = 开 | 关
当设置为最近释放的空间,并且不再由池分配时,将定期修剪...自动 TRIM 不会在释放后立即回收块。相反,它会乐观地推迟将较小范围聚合为几个较大范围。然后可以更有效地将这些范围发送到存储。
有关详细信息,您可以查看这些代码注释:
Automatic TRIM happens continuously in the background and operates
solely on recently freed blocks (ms_trim not ms_allocatable).
...
While the automatic TRIM process is highly effective it is more likely
than a manual TRIM to encounter tiny ranges. Ranges less than or equal to
'zfs_trim_extent_bytes_min' (32k) are considered too small to efficiently
TRIM and are skipped. This means small amounts of freed space may not
be automatically trimmed.
答案2
使用此命令可以查看池 [tank] 上请求的 io,包括 trim。
zpool iostat -r [tank]