]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-journal: use FILE streams to buffer write_uint64()
authorVito Caputo <vcaputo@pengaru.com>
Tue, 31 Aug 2021 01:20:53 +0000 (18:20 -0700)
committerLennart Poettering <lennart@poettering.net>
Thu, 2 Sep 2021 09:29:23 +0000 (11:29 +0200)
commita4121e965f43bc323ec3c0ac212cee9d339f7be0
treeec2f73b10f6d3e0d87e8da6be2869441830c85d9
parentfad45198b6a640ca39dd37d38c0d9c209b748758
sd-journal: use FILE streams to buffer write_uint64()

journal_file_verify() uses a set of tmpfs files to create lists
of object positions by type.

The existing code used a bare write() call for every object
position written, incurring a syscall per listed object.

This commit encapsulates the bare file descriptors in FILE *'s
and replaces the bare write with fwrite, buffering the writes so
there's less syscalls.

Cached `journalctl --verify` tests showed a ~8% faster runtime
with this change on a release build, verifying 1.3GiB of
production journals across 16 files.
src/libsystemd/sd-journal/journal-verify.c