mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
ZLE compression: don't use BPE_PAYLOAD_SIZE
ZLE compressor needs additional bytes to process d_len argument efficiently. Don't use BPE_PAYLOAD_SIZE as d_len with it before we rework zle compressor somehow. 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:
parent
522f2629c8
commit
b32d48a625
@ -604,8 +604,8 @@ extern int zio_alloc_zil(spa_t *spa, objset_t *os, uint64_t txg,
|
|||||||
extern void zio_flush(zio_t *zio, vdev_t *vd);
|
extern void zio_flush(zio_t *zio, vdev_t *vd);
|
||||||
extern void zio_shrink(zio_t *zio, uint64_t size);
|
extern void zio_shrink(zio_t *zio, uint64_t size);
|
||||||
|
|
||||||
extern size_t zio_get_compression_max_size(uint64_t gcd_alloc,
|
extern size_t zio_get_compression_max_size(enum zio_compress compress,
|
||||||
uint64_t min_alloc, size_t s_len);
|
uint64_t gcd_alloc, uint64_t min_alloc, size_t s_len);
|
||||||
extern int zio_wait(zio_t *zio);
|
extern int zio_wait(zio_t *zio);
|
||||||
extern void zio_nowait(zio_t *zio);
|
extern void zio_nowait(zio_t *zio);
|
||||||
extern void zio_execute(void *zio);
|
extern void zio_execute(void *zio);
|
||||||
|
@ -10525,7 +10525,8 @@ l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, l2arc_write_callback_t *cb)
|
|||||||
/* try to compress the buffer, at least one sector to save */
|
/* try to compress the buffer, at least one sector to save */
|
||||||
psize = zio_compress_data(ZIO_COMPRESS_LZ4,
|
psize = zio_compress_data(ZIO_COMPRESS_LZ4,
|
||||||
abd_buf->abd, &abd, sizeof (*lb),
|
abd_buf->abd, &abd, sizeof (*lb),
|
||||||
zio_get_compression_max_size(dev->l2ad_vdev->vdev_ashift,
|
zio_get_compression_max_size(ZIO_COMPRESS_LZ4,
|
||||||
|
dev->l2ad_vdev->vdev_ashift,
|
||||||
dev->l2ad_vdev->vdev_ashift, sizeof (*lb)), 0);
|
dev->l2ad_vdev->vdev_ashift, sizeof (*lb)), 0);
|
||||||
|
|
||||||
/* a log block is never entirely zero */
|
/* a log block is never entirely zero */
|
||||||
|
@ -1706,15 +1706,20 @@ zio_roundup_alloc_size(spa_t *spa, uint64_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
zio_get_compression_max_size(uint64_t gcd_alloc, uint64_t min_alloc,
|
zio_get_compression_max_size(enum zio_compress compress, uint64_t gcd_alloc,
|
||||||
size_t s_len)
|
uint64_t min_alloc, size_t s_len)
|
||||||
{
|
{
|
||||||
size_t d_len;
|
size_t d_len;
|
||||||
|
|
||||||
/* minimum 12.5% must be saved (legacy value, may be changed later) */
|
/* minimum 12.5% must be saved (legacy value, may be changed later) */
|
||||||
d_len = s_len - (s_len >> 3);
|
d_len = s_len - (s_len >> 3);
|
||||||
|
|
||||||
|
/* ZLE can't use exactly d_len bytes, it needs more, so ignore it */
|
||||||
|
if (compress == ZIO_COMPRESS_ZLE)
|
||||||
|
return (d_len);
|
||||||
|
|
||||||
d_len = d_len - d_len % gcd_alloc;
|
d_len = d_len - d_len % gcd_alloc;
|
||||||
|
|
||||||
if (d_len < min_alloc)
|
if (d_len < min_alloc)
|
||||||
return (BPE_PAYLOAD_SIZE);
|
return (BPE_PAYLOAD_SIZE);
|
||||||
return (d_len);
|
return (d_len);
|
||||||
@ -1902,8 +1907,8 @@ zio_write_compress(zio_t *zio)
|
|||||||
else
|
else
|
||||||
psize = zio_compress_data(compress, zio->io_abd, &cabd,
|
psize = zio_compress_data(compress, zio->io_abd, &cabd,
|
||||||
lsize,
|
lsize,
|
||||||
zio_get_compression_max_size(spa->spa_gcd_alloc,
|
zio_get_compression_max_size(compress,
|
||||||
spa->spa_min_alloc, lsize),
|
spa->spa_gcd_alloc, spa->spa_min_alloc, lsize),
|
||||||
zp->zp_complevel);
|
zp->zp_complevel);
|
||||||
if (psize == 0) {
|
if (psize == 0) {
|
||||||
compress = ZIO_COMPRESS_OFF;
|
compress = ZIO_COMPRESS_OFF;
|
||||||
|
Loading…
Reference in New Issue
Block a user