chiark / gitweb /
journal: use tail/head timestamps from header for cutoff logic
[elogind.git] / src / journal / journal-file.c
index 0aada9c4197c76c5e71efbb0eb82761036de4161..a110a0090f33c217ca6e55354475adbcd3893733 100644 (file)
@@ -2312,9 +2312,6 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
             ts.monotonic < le64toh(to->header->tail_entry_monotonic))
                 return -EINVAL;
 
-        if (ts.realtime < le64toh(to->header->tail_entry_realtime))
-                return -EINVAL;
-
         n = journal_file_entry_n_items(o);
         items = alloca(sizeof(EntryItem) * n);
 
@@ -2449,26 +2446,21 @@ void journal_default_metrics(JournalMetrics *m, int fd) {
 }
 
 int journal_file_get_cutoff_realtime_usec(JournalFile *f, usec_t *from, usec_t *to) {
-        Object *o;
-        int r;
-
         assert(f);
         assert(from || to);
 
         if (from) {
-                r = journal_file_next_entry(f, NULL, 0, DIRECTION_DOWN, &o, NULL);
-                if (r <= 0)
-                        return r;
+                if (f->header->head_entry_realtime == 0)
+                        return -ENOENT;
 
-                *from = le64toh(o->entry.realtime);
+                *from = le64toh(f->header->head_entry_realtime);
         }
 
         if (to) {
-                r = journal_file_next_entry(f, NULL, 0, DIRECTION_UP, &o, NULL);
-                if (r <= 0)
-                        return r;
+                if (f->header->tail_entry_realtime == 0)
+                        return -ENOENT;
 
-                *to = le64toh(o->entry.realtime);
+                *to = le64toh(f->header->tail_entry_realtime);
         }
 
         return 1;