|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From b4232628f3d4b00c967310d56c0e95715c9d05cd Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Evangelos Foutras <evangelos@foutrelis.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Sat, 30 Aug 2014 10:13:43 +0300
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] journal/compress: use LZ4_compress_continue()
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
We can't use LZ4_compress_limitedOutput_continue() because in the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
worst-case scenario the compressed output can be slightly bigger than
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
the input block. This generally affects very few blocks and is no reason
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
to abort the compression process.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
I ran into this when I noticed that Chromium core dumps weren't being
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
compressed. After switching to LZ4_compress_continue() a ~330MB Chromium
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
core dump gets compressed to ~17M.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/journal/compress.c | 6 +++---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/journal/compress.c b/src/journal/compress.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 52a4c100b3..c4c715be2f 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/journal/compress.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/journal/compress.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -460,10 +460,10 @@ int compress_stream_lz4(int fdf, int fdt, off_t max_bytes) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
total_in += n;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- r = LZ4_compress_limitedOutput_continue(&lz4_data, buf, out, n, n);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ r = LZ4_compress_continue(&lz4_data, buf, out, n);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r == 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug("Compressed size exceeds original, aborting compression.");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- return -ENOBUFS;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error("LZ4 compression failed.");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return -EBADMSG;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
header = htole32(r);
|