
我讀過了“新增 TRIM 支援”autotrim
文章,但未能找到「ZFS 何時以及多久發生一次?」的線索。我怎樣才能觀察 的活動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,包括修剪。
zpool iostat -r [tank]