Allow and prefer special vdevs as ZIL

Before this change ZIL blocks were allocated only from normal or
SLOG vdevs.  In typical situation when special vdevs are SSDs and
normal are HDDs it could cause weird inversions when data blocks
are written to SSDs, but ZIL referencing them to HDDs.

This change assumes that special vdevs typically have much better
(or at least not worse) latency than normal, and so in absence of
SLOGs should store ZIL blocks.  It means similar to normal vdevs
introduction of special embedded log allocation class and updating
the allocation fallback order to: SLOG -> special embedded log ->
special -> normal embedded log -> normal.

The code tries to guess whether data block is going to be written
to normal or special vdev (it can not be done precisely before
compression) and prefer indirect writes for blocks written to a
special vdev to avoid double-write.  For blocks that are going to
be written to normal vdev, special vdev by default plays as SLOG,
reducing write latency by the cost of higher special vdev wear,
but it is tunable via module parameter.

This should allow HDD pools with decent SSD as special vdev to
work under synchronous workloads without requiring additional
SLOG SSD, impractical in many scenarios.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <rob.norris@klarasystems.com>
Reviewed-by: Paul Dagnelie <paul.dagnelie@klarasystems.com>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #17505
This commit is contained in:
Alexander Motin
2025-07-18 21:44:14 -04:00
committed by GitHub
parent 2669b00f13
commit be1e991a1a
13 changed files with 164 additions and 44 deletions
+12 -4
View File
@@ -1713,10 +1713,18 @@ Similar to
but for cleanup of old indirection records for removed vdevs.
.
.It Sy zfs_immediate_write_sz Ns = Ns Sy 32768 Ns B Po 32 KiB Pc Pq s64
Largest data block to write to the ZIL.
Larger blocks will be treated as if the dataset being written to had the
.Sy logbias Ns = Ns Sy throughput
property set.
Largest write size to store the data directly into the ZIL if
.Sy logbias Ns = Ns Sy latency .
Larger writes may be written indirectly similar to
.Sy logbias Ns = Ns Sy throughput .
In presence of SLOG this parameter is ignored, as if it was set to infinity,
storing all written data into ZIL to not depend on regular vdev latency.
.
.It Sy zil_special_is_slog Ns = Ns Sy 1 Ns | Ns 0 Pq int
When enabled, and written blocks go to normal vdevs, treat present special
vdevs as SLOGs, storing all synchronously written data into ZIL directly.
Disabling this forces the indirect writes to preserve special vdev write
throughput and endurance, likely at the cost of normal vdev latency.
.
.It Sy zfs_initialize_value Ns = Ns Sy 16045690984833335022 Po 0xDEADBEEFDEADBEEE Pc Pq u64
Pattern written to vdev free space by