]> git.ipfire.org Git - thirdparty/elfutils.git/commit
debuginfod: optimize extraction from seekable xz archives
authorOmar Sandoval <osandov@fb.com>
Tue, 23 Jul 2024 22:35:41 +0000 (15:35 -0700)
committerAaron Merey <amerey@redhat.com>
Wed, 24 Jul 2024 22:13:40 +0000 (18:13 -0400)
commitb2dd8b94d92bc14d144877374cf94d88030ec73b
treeda28d1958dbc18a2584eba7c6222fb5f2ce0cabf
parent95a09d02b6965c7af201125c8830f0559855bf53
debuginfod: optimize extraction from seekable xz archives

The kernel debuginfo packages on Fedora, Debian, and Ubuntu, and many of
their downstreams, are all compressed with xz in multi-threaded mode,
which allows random access.  We can use this to bypass the full archive
extraction and dramatically speed up kernel debuginfo requests (from ~50
seconds in the worst case to < 0.25 seconds).

This works because multi-threaded xz compression splits up the stream
into many independently compressed blocks.  The stream ends with an
index of blocks.  So, to seek to an offset, we find the block containing
that offset in the index and then decompress and throw away data until
we reach the offset within the block.  We can then decompress the
desired amount of data, possibly from subsequent blocks.  There's no
high-level API in liblzma to do this, but we can do it by stitching
together a few low-level APIs.

We need to pass down the file ids then look up the size, uncompressed
offset, and mtime in the _r_seekable table.  Note that this table is not
yet populated, so this commit has no functional change on its own.

Signed-off-by: Omar Sandoval <osandov@fb.com>
configure.ac
debuginfod/Makefile.am
debuginfod/debuginfod.cxx