diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-10-14 04:44:50 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-10-14 04:44:50 +0200 |
commit | 3fbf9cbb02690e40cd65802e777519f3f3c8d88a (patch) | |
tree | ac17b4bfe762003e2681246356848938c000e787 /src/journal/journald.c | |
parent | 0ac38b707212e9aa40e25d65ffbae648cc9116f5 (diff) |
journal: implement parallel file traversal
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r-- | src/journal/journald.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c index 7a2b50b017..1143d81abc 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -95,6 +95,8 @@ static JournalFile* find_journal(Server *s, uid_t uid) { char *p; int r; JournalFile *f; + char ids[33]; + sd_id128_t machine; assert(s); @@ -105,11 +107,15 @@ static JournalFile* find_journal(Server *s, uid_t uid) { if (uid <= 0) return s->system_journal; + r = sd_id128_get_machine(&machine); + if (r < 0) + return s->system_journal; + f = hashmap_get(s->user_journals, UINT32_TO_PTR(uid)); if (f) return f; - if (asprintf(&p, "/var/log/journal/user-%lu.journal", (unsigned long) uid) < 0) + if (asprintf(&p, "/var/log/journal/%s/user-%lu.journal", sd_id128_to_string(machine, ids), (unsigned long) uid) < 0) return s->system_journal; r = journal_file_open(p, O_RDWR|O_CREAT, 0640, NULL, &f); @@ -401,16 +407,11 @@ static int system_journal_open(Server *s) { /* /var didn't work, so try /run, but this time we * create the prefix too */ - fn = strappend("/run/log/journal/", ids); - if (!fn) - return -ENOMEM; - (void) mkdir_p(fn, 0755); - free(fn); - - /* Then create the runtime journal file */ fn = join("/run/log/journal/", ids, "/system.journal", NULL); if (!fn) return -ENOMEM; + + (void) mkdir_parents(fn, 0755); r = journal_file_open(fn, O_RDWR|O_CREAT, 0640, NULL, &s->runtime_journal); free(fn); |