summaryrefslogtreecommitdiff
path: root/src/journal/journal-file.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-21 21:35:50 +0100
committerLennart Poettering <lennart@poettering.net>2016-02-21 21:35:50 +0100
commit1f210bdbe65dffcb6daeb9d9cddbf0b2d02f8718 (patch)
tree13fc5e73ea6bb4526ae32d3241432dd0fe2b7f63 /src/journal/journal-file.h
parentc7044f9ed295ca2d83bcd0059a86a9443361eaec (diff)
parentb58c888f30947b29730768c48ad402a2c5b65be9 (diff)
Merge pull request #2650 from vcaputo/async_fsync
Perform journal offlines asynchronously when possible
Diffstat (limited to 'src/journal/journal-file.h')
-rw-r--r--src/journal/journal-file.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index 07b9561b8a..9ad6013359 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -63,6 +63,16 @@ typedef enum LocationType {
LOCATION_SEEK
} LocationType;
+typedef enum OfflineState {
+ OFFLINE_JOINED,
+ OFFLINE_SYNCING,
+ OFFLINE_OFFLINING,
+ OFFLINE_CANCEL,
+ OFFLINE_AGAIN_FROM_SYNCING,
+ OFFLINE_AGAIN_FROM_OFFLINING,
+ OFFLINE_DONE
+} OfflineState;
+
typedef struct JournalFile {
int fd;
@@ -105,6 +115,9 @@ typedef struct JournalFile {
OrderedHashmap *chain_cache;
+ pthread_t offline_thread;
+ volatile OfflineState offline_state;
+
#if defined(HAVE_XZ) || defined(HAVE_LZ4)
void *compress_buffer;
size_t compress_buffer_size;
@@ -136,11 +149,14 @@ int journal_file_open(
bool seal,
JournalMetrics *metrics,
MMapCache *mmap_cache,
+ Set *deferred_closes,
JournalFile *template,
JournalFile **ret);
-int journal_file_set_offline(JournalFile *f);
+int journal_file_set_offline(JournalFile *f, bool wait);
+bool journal_file_is_offlining(JournalFile *f);
JournalFile* journal_file_close(JournalFile *j);
+void journal_file_close_set(Set *s);
int journal_file_open_reliably(
const char *fname,
@@ -150,6 +166,7 @@ int journal_file_open_reliably(
bool seal,
JournalMetrics *metrics,
MMapCache *mmap_cache,
+ Set *deferred_closes,
JournalFile *template,
JournalFile **ret);
@@ -223,7 +240,7 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
void journal_file_dump(JournalFile *f);
void journal_file_print_header(JournalFile *f);
-int journal_file_rotate(JournalFile **f, bool compress, bool seal);
+int journal_file_rotate(JournalFile **f, bool compress, bool seal, Set *deferred_closes);
void journal_file_post_change(JournalFile *f);
int journal_file_enable_post_change_timer(JournalFile *f, sd_event *e, usec_t t);