mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +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
+8
-5
@@ -29,6 +29,7 @@
|
||||
* Copyright (c) 2019, 2023, Klara Inc.
|
||||
* Copyright (c) 2019, Allan Jude
|
||||
* Copyright (c) 2020, The FreeBSD Foundation [1]
|
||||
* Copyright (c) 2021, 2024 by George Melikov. All rights reserved.
|
||||
*
|
||||
* [1] Portions of this software were developed by Allan Jude
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
@@ -1786,7 +1787,7 @@ arc_hdr_authenticate(arc_buf_hdr_t *hdr, spa_t *spa, uint64_t dsobj)
|
||||
!HDR_COMPRESSION_ENABLED(hdr)) {
|
||||
abd = NULL;
|
||||
csize = zio_compress_data(HDR_GET_COMPRESS(hdr),
|
||||
hdr->b_l1hdr.b_pabd, &abd, lsize, hdr->b_complevel);
|
||||
hdr->b_l1hdr.b_pabd, &abd, lsize, lsize, hdr->b_complevel);
|
||||
ASSERT3P(abd, !=, NULL);
|
||||
ASSERT3U(csize, <=, psize);
|
||||
abd_zero_off(abd, csize, psize - csize);
|
||||
@@ -9029,8 +9030,8 @@ l2arc_apply_transforms(spa_t *spa, arc_buf_hdr_t *hdr, uint64_t asize,
|
||||
if (compress != ZIO_COMPRESS_OFF && !HDR_COMPRESSION_ENABLED(hdr)) {
|
||||
cabd = abd_alloc_for_io(MAX(size, asize), ismd);
|
||||
uint64_t csize = zio_compress_data(compress, to_write, &cabd,
|
||||
size, hdr->b_complevel);
|
||||
if (csize > psize) {
|
||||
size, MIN(size, psize), hdr->b_complevel);
|
||||
if (csize >= size || csize > psize) {
|
||||
/*
|
||||
* We can't re-compress the block into the original
|
||||
* psize. Even if it fits into asize, it does not
|
||||
@@ -10521,9 +10522,11 @@ l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, l2arc_write_callback_t *cb)
|
||||
*/
|
||||
list_insert_tail(&cb->l2wcb_abd_list, abd_buf);
|
||||
|
||||
/* try to compress the buffer */
|
||||
/* try to compress the buffer, at least one sector to save */
|
||||
psize = zio_compress_data(ZIO_COMPRESS_LZ4,
|
||||
abd_buf->abd, &abd, sizeof (*lb), 0);
|
||||
abd_buf->abd, &abd, sizeof (*lb),
|
||||
zio_get_compression_max_size(dev->l2ad_vdev->vdev_ashift,
|
||||
dev->l2ad_vdev->vdev_ashift, sizeof (*lb)), 0);
|
||||
|
||||
/* a log block is never entirely zero */
|
||||
ASSERT(psize != 0);
|
||||
|
||||
Reference in New Issue
Block a user