mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
zio_compress: introduce max size threshold
Now default compression is lz4, which can stop compression process by itself on incompressible data. If there are additional size checks - we will only make our compressratio worse. New usable compression thresholds are: - less than BPE_PAYLOAD_SIZE (embedded_data feature); - at least one saved sector. Old 12.5% threshold is left to minimize affect on existing user expectations of CPU utilization. If data wasn't compressed - it will be saved as ZIO_COMPRESS_OFF, so if we really need to recompress data without ashift info and check anything - we can just compress it with zero threshold. So, we don't need a new feature flag here! Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: George Melikov <mail@gmelikov.ru> Closes #9416
This commit is contained in:
committed by
Brian Behlendorf
parent
4bf6a2ab87
commit
522f2629c8
+18
-8
@@ -917,14 +917,24 @@ zeroes (the NUL byte).
|
||||
When a zero-filled block is detected, it is stored as
|
||||
a hole and not compressed using the indicated compression algorithm.
|
||||
.Pp
|
||||
Any block being compressed must be no larger than 7/8 of its original size
|
||||
after compression, otherwise the compression will not be considered worthwhile
|
||||
and the block saved uncompressed.
|
||||
Note that when the logical block is less than
|
||||
8 times the disk sector size this effectively reduces the necessary compression
|
||||
ratio; for example, 8 KiB blocks on disks with 4 KiB disk sectors must compress
|
||||
to 1/2
|
||||
or less of their original size.
|
||||
All blocks are allocated as a whole number of sectors
|
||||
.Pq chunks of 2^ Ns Sy ashift No bytes , e.g . Sy 512B No or Sy 4KB .
|
||||
Compression may result in a non-sector-aligned size, which will be rounded up
|
||||
to a whole number of sectors.
|
||||
If compression saves less than one whole sector,
|
||||
the block will be stored uncompressed.
|
||||
Therefore, blocks whose logical size is a small number of sectors will
|
||||
experience less compression
|
||||
(e.g. for
|
||||
.Sy recordsize Ns = Ns Sy 16K
|
||||
with
|
||||
.Sy 4K
|
||||
sectors, which have 4 sectors per block,
|
||||
compression needs to save at least 25% to actually save space on disk).
|
||||
.Pp
|
||||
There is
|
||||
.Sy 12.5%
|
||||
default compression threshold in addition to sector rounding.
|
||||
.It Xo
|
||||
.Sy context Ns = Ns Sy none Ns | Ns
|
||||
.Ar SELinux-User : Ns Ar SELinux-Role : Ns Ar SELinux-Type : Ns Ar Sensitivity-Level
|
||||
|
||||
Reference in New Issue
Block a user