journal: stop using JournalFile.mmap everywhere
authorVito Caputo <vcaputo@pengaru.com>
Thu, 25 Nov 2021 23:24:48 +0000 (15:24 -0800)
committerVito Caputo <vcaputo@pengaru.com>
Tue, 7 Dec 2021 21:00:25 +0000 (13:00 -0800)
commit8b4fbbb0a121028c9304e96df322ce491f551e34
tree9bb75eb4d3b112f34deff2b0443695dc04da74fa
parent176bf8b82783b76c85e890610a6c2c6fafb5db6a
journal: stop using JournalFile.mmap everywhere

Preparatory commit; before JournalFile can stop hanging onto its
copy of MMapCache, all these users need to find another way.

Most of the time these callers already have the MMapCache onhand,
so it's no big deal for them to just supply it.

journal_file_rotate() in particular needed to change, and it
seemed wise to not use the mmap_cache_fd_cache() accessor on
f->cache_fd, instead requiring the caller supply the cache to
use.  This was done with an eye towards a potential future where
the journal_file_archive() isolates the cache_fd to a private
cache, which the newly rotated-to file wouldn't be allowed to
use.  It's no biggie for the existing callers to just provide the
appropriate surviving cache.

Basically the mmap_cache_fd_cache() accessor was added just for
journal-verify.c's (ab)use of the mmap-cache.  Which, if the
ugly singleton MMapCache assumption ever goes away, can be
cleaned up to simply use a separate MMapCache for those search
arrays.
src/journal-remote/journal-remote-write.c
src/journal/journald-file.c
src/journal/journald-file.h
src/journal/journald-server.c
src/journal/test-journal.c
src/libsystemd/sd-journal/journal-file.h
src/libsystemd/sd-journal/journal-verify.c