ZFS 何时以及多久进行一次“自动修剪”?

soh*_*man 3 zfs trim

我已阅读“添加 TRIM 支持”文章,但未能获得有关“ZFS 何时以及多久autotrim发生一次?”的线索。以及如何观察 的活动autotrim

提前感谢您的评论。

sho*_*hok 6

ZFS autotrim 确实是一个连续的、机会主义的操作,它在块/范围被释放后运行。

手册页:

自动修剪 = 开 | 离开

当设置为最近已释放且不再由池分配的空间时,将定期修剪...自动修剪不会在释放后立即回收块。相反,它会乐观地延迟将较小的范围聚合为几个较大的范围。然后可以更有效地将这些发送到存储。

有关更多详细信息,您可以查看这些代码注释:

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.
Run Code Online (Sandbox Code Playgroud)


小智 6

使用此命令查看池 [tank] 上请求的 io,包括修剪。

zpool iostat -r [tank]
Run Code Online (Sandbox Code Playgroud)