]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/journal/journal-file.c
journal: asynchronous journal_file_set_offline()
authorVito Caputo <vito.caputo@coreos.com>
Fri, 12 Feb 2016 12:59:57 +0000 (04:59 -0800)
committerVito Caputo <vito.caputo@coreos.com>
Sat, 20 Feb 2016 02:50:20 +0000 (18:50 -0800)
commitac2e41f5103ce2c679089c4f8fb6be61d7caec07
treeaa9015d7a0e9466e783704d857dd5db0fec70512
parent69a3a6fd3d96101d42a01d0e7d33ae2ef613e54a
journal: asynchronous journal_file_set_offline()

This adds a wait flag to journal_file_set_offline(), when false the offline is
performed asynchronously in a separate thread.

When wait is true, if an asynchronous offline is already in-progress it is
restarted and waited for.  Otherwise the offline is performed synchronously
without the use of a thread.

journal_file_set_online() cancels or waits for the asynchronous offline to
complete if in-flight, depending on where in the offline process the thread
happens to be.  If the thread is in the fsync() phase, it is cancelled and
waiting is unnecessary.  Otherwise, the thread is joined before proceeding.

A new offline_state member is added to JournalFile which is used via
atomic operations for communicating between the offline thread and the
journal_file_set_{offline,online}() functions.
src/journal/journal-file.c
src/journal/journal-file.h
src/journal/journald-server.c