]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-journal: cache last entry offset and journal file state
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Jan 2024 19:27:59 +0000 (04:27 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 11 Feb 2024 16:23:16 +0000 (01:23 +0900)
commit99e6f682d3627c2c06d99bb3c3756e448e8d9bd1
treed019a528561f70a8c340f5c61b4e12df89a14d5f
parent4ebf678f1ff6ca5b918423720f5a0348fa352fa9
sd-journal: cache last entry offset and journal file state

When the offset of the last entry object (or last object for journal
files generated by an old journald) is not changed, the timestamps
should be updated by journal_file_read_tail_timestamp() are unchanged.
So, we can drop to call fstat() in the function.

As, the journal header is always mapped, so we can read the offset and
journal file state without calling fstat.
Still, when the last entry offset is changed, we may need to call fstat()
to read the entry object. But, hopefully the number of fstat() call
can be reduced.
src/libsystemd/sd-journal/journal-file.c
src/libsystemd/sd-journal/journal-file.h
src/libsystemd/sd-journal/sd-journal.c