chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
journal: optimize iteration by returning previously found candidate entry
[elogind.git]
/
src
/
journal
/
sd-journal.c
diff --git
a/src/journal/sd-journal.c
b/src/journal/sd-journal.c
index 0aaf2257d4c668640a151f0b5de15b8ff7cbd8a4..0fefe2bc6e38ee03b879ad3cf4aeefa7c69bacc0 100644
(file)
--- a/
src/journal/sd-journal.c
+++ b/
src/journal/sd-journal.c
@@
-742,6
+742,12
@@
static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc
f->last_n_entries = n_entries;
if (f->last_direction == direction && f->current_offset > 0) {
f->last_n_entries = n_entries;
if (f->last_direction == direction && f->current_offset > 0) {
+ /* LOCATION_SEEK here means we did the work in a previous
+ * iteration and the current location already points to a
+ * candidate entry. */
+ if (f->location_type == LOCATION_SEEK)
+ return 1;
+
cp = f->current_offset;
r = journal_file_move_to_object(f, OBJECT_ENTRY, cp, &c);
cp = f->current_offset;
r = journal_file_move_to_object(f, OBJECT_ENTRY, cp, &c);