Skip to content

Commit 20dd16d

Browse files
authored
Make zdb -R scale less poorly
zdb -R with :d tries to use gzip decompression 9 times per size. There's absolutely no reason for that, they're all the same decompressor. Reviewed-by: Brian Atkinson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #15726
1 parent 1a11ad9 commit 20dd16d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/zdb/zdb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8506,6 +8506,14 @@ zdb_decompress_block(abd_t *pabd, void *buf, void *lbuf, uint64_t lsize,
85068506
*cfuncp++ = ZIO_COMPRESS_LZ4;
85078507
*cfuncp++ = ZIO_COMPRESS_LZJB;
85088508
mask |= ZIO_COMPRESS_MASK(LZ4) | ZIO_COMPRESS_MASK(LZJB);
8509+
/*
8510+
* Every gzip level has the same decompressor, no need to
8511+
* run it 9 times per bruteforce attempt.
8512+
*/
8513+
mask |= ZIO_COMPRESS_MASK(GZIP_2) | ZIO_COMPRESS_MASK(GZIP_3);
8514+
mask |= ZIO_COMPRESS_MASK(GZIP_4) | ZIO_COMPRESS_MASK(GZIP_5);
8515+
mask |= ZIO_COMPRESS_MASK(GZIP_6) | ZIO_COMPRESS_MASK(GZIP_7);
8516+
mask |= ZIO_COMPRESS_MASK(GZIP_8) | ZIO_COMPRESS_MASK(GZIP_9);
85098517
for (int c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++)
85108518
if (((1ULL << c) & mask) == 0)
85118519
*cfuncp++ = c;

0 commit comments

Comments
 (0)