clamp kernel dump compression level when using gzip
If the configured compression level for kernel dumps it outside the supported range, clamp it to the closest supported level. Previously, dumpon would fail. zstd already does this internally, so the compressor needs no change. Reviewed by: cem markj MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D23765
This commit is contained in:
parent
3ae8839afe
commit
3cd1f28e4a
@ -117,6 +117,13 @@ gz_init(size_t maxiosize, int level)
|
||||
s->gz_stream.next_in = Z_NULL;
|
||||
s->gz_stream.avail_in = 0;
|
||||
|
||||
if (level != Z_DEFAULT_COMPRESSION) {
|
||||
if (level < Z_BEST_SPEED)
|
||||
level = Z_BEST_SPEED;
|
||||
else if (level > Z_BEST_COMPRESSION)
|
||||
level = Z_BEST_COMPRESSION;
|
||||
}
|
||||
|
||||
error = deflateInit2(&s->gz_stream, level, Z_DEFLATED, -MAX_WBITS,
|
||||
DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
||||
if (error != 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user