]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/journal/journalctl.c
journalctl: Improve boot ID lookup
authorJan Janssen <medhefgo@web.de>
Fri, 1 May 2015 13:15:16 +0000 (15:15 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 18 May 2015 22:26:48 +0000 (00:26 +0200)
commit596a23293d28f93843aef86721b90043e74d3081
treea84b2f37f6ae96e42e9a6b6695314318d6b152ea
parentf53d1fcdb355125a1347acf0d2d1ffa7264d6bfe
journalctl: Improve boot ID lookup

This method should greatly improve offset based lookup, by simply jumping
from one boot to the next boot. It starts at the journal head to get the
a boot ID, makes a _BOOT_ID match and then comes from the opposite
journal direction (tail) to get to the end that boot. After flushing the matches
and advancing the journal from that exact position, we arrive at the start
of next boot. Rinse and repeat.

This is faster than the old method of aggregating the full boot listing just
so we can jump to a specific boot, which can be a real pain on big journals
just for a mere "-b -1" case.

As an additional benefit --list-boots should improve slightly too, because
it does less seeking.

Note that there can be a change in boot order with this lookup method
because it will use the order of boots in the journal, not the realtime stamp
stored in them. That's arguably better, though.
Another deficiency is that it will get confused with boots interleaving in the
journal, therefore, it will refuse operation in --merge, --file and --directory mode.

https://bugs.freedesktop.org/show_bug.cgi?id=72601
src/journal/journalctl.c