]> git.ipfire.org Git - thirdparty/systemd.git/commit
coredump: use lz4frame api to compress coredumps
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 7 Dec 2014 02:33:27 +0000 (21:33 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 11 Oct 2015 03:05:21 +0000 (23:05 -0400)
commit4b5bc5396c090ee41c45cab9052372d296c4a2f4
tree374d0ab4f6da6b6ccc2716c9291027c9ef1a3952
parent898d5660eba688c566e90d0a15050dfeb8b8265d
coredump: use lz4frame api to compress coredumps

This converts the stream compression to use the new lz4frame api,
compatible with lz4cat. Previous code used custom headers, so the
compressed file was not compatible with lz4 command line tools.
I considered this the last blocker to using lz4 by default.

Speed seems to be reasonable, although a bit (a few percent) slower
than the lz4 binary, even though compression is the same. I don't
consider this important. It could be caused by the overhead of library
calls, but is probably caused by slightly different buffer sizes or
such. The code in this patch uses mmap, since since this allows the
buffer to be reused while not making the code more complicated at all.
In my testing, this version is noticably faster (~20%) than a naive
single-buffered version. mmap can cause the program to be killed with
SIGBUS, if the underlying file is truncated or a disk error occurs. We
only use this from within coredump and coredumpctl, so I don't
consider this an issue.

Old decompression code is retained and is used if the new code fails
indicating a format error. There have been reports of various smaller
distributions using previous lz4 code, i.e. the old format, and it is
nice to provide backwards compatibility. We can remove the legacy code
in a few versions.

The way that blobs are compressed in the journal is not affected.
src/journal/compress.c
src/journal/test-compress.c