aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2024-01-12 14:55:17 -0500
committerGitHub <[email protected]>2024-01-12 11:55:17 -0800
commit20dd16d9f7c9e633c08400f9810db9a84aa20a80 (patch)
treefd1e87ba9649b611e625924cb4a32b8860994cfd /cmd
parent1a11ad9d20ab115b5d53f038f97a25d59a6bb5cf (diff)
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
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zdb/zdb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index cd934b2ae..6894e33cb 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -8506,6 +8506,14 @@ zdb_decompress_block(abd_t *pabd, void *buf, void *lbuf, uint64_t lsize,
*cfuncp++ = ZIO_COMPRESS_LZ4;
*cfuncp++ = ZIO_COMPRESS_LZJB;
mask |= ZIO_COMPRESS_MASK(LZ4) | ZIO_COMPRESS_MASK(LZJB);
+ /*
+ * Every gzip level has the same decompressor, no need to
+ * run it 9 times per bruteforce attempt.
+ */
+ mask |= ZIO_COMPRESS_MASK(GZIP_2) | ZIO_COMPRESS_MASK(GZIP_3);
+ mask |= ZIO_COMPRESS_MASK(GZIP_4) | ZIO_COMPRESS_MASK(GZIP_5);
+ mask |= ZIO_COMPRESS_MASK(GZIP_6) | ZIO_COMPRESS_MASK(GZIP_7);
+ mask |= ZIO_COMPRESS_MASK(GZIP_8) | ZIO_COMPRESS_MASK(GZIP_9);
for (int c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++)
if (((1ULL << c) & mask) == 0)
*cfuncp++ = c;