commit 94670ff8fc72a4adb19d96be1c9d84ab2cdbb835
Author: Aron Xu <happyaron.xu@gmail.com>
Date: Mon May 25 21:19:41 2026 +0800
periodic-trim: support SATA SSDs and mixed pools in auto mode
The auto mode previously only trimmed NVMe-only pools. Extend it to
also cover SATA SSDs with queued TRIM and mixed pools (e.g. NVMe SSDs
combined with regular HDDs or older SATA SSDs).
Each data leaf device in a pool is classified as either safe to trim
or skipped. Safe device paths are passed to zpool trim in a single
grouped call:
- safe: NVMe (always queued), non-rotational SATA with queued TRIM
- skip: all rotational devices, non-queued TRIM (blocking I/O),
unknown devices behind SAS HBAs (conservative)
Aux vdevs (cache, spare) are excluded since they are not targets of
zpool trim.
Device TRIM capability is read from the kernel's ata_device/trim
sysfs attribute (available since Linux 4.2, commit f303074160d3)
which reflects both protocol capability and device-specific quirks
(ATA_QUIRK_NO_NCQ_TRIM, ATA_QUIRK_NOTRIM). The correct ata_device
is identified by mapping the SCSI address (H:B:T:L) to the ATA
device name using nr_pmp_links to distinguish direct-attached
devices from those behind port multipliers. PATA master/slave
configurations are also handled.
Among the 16 debian patches available in version 2.4.2-2 of the package, we noticed the following issues: