summaryrefslogtreecommitdiff
path: root/src/journal/journald.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-07-17 00:36:15 +0200
committerLennart Poettering <lennart@poettering.net>2012-07-17 00:59:03 +0200
commit4a92baf3fa97c73f04438b5814db58783f920b32 (patch)
treef5e102e67986e5de420fea219ab7fa0237e17503 /src/journal/journald.c
parent71fa6f006f92831c0c02e844b4c35e4b7197c6d6 (diff)
journal: size journal data hash table based on maximum file size metrics
The default of 2047 hash table entries turned out to result in way too many collisions for bigger files, hence scale the hash table size by the estimated maximum file size.
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r--src/journal/journald.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 8f00aef5bd..d8cfa66b75 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -313,7 +313,7 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
journal_file_close(f);
}
- r = journal_file_open_reliably(p, O_RDWR|O_CREAT, 0640, s->system_journal, &f);
+ r = journal_file_open_reliably(p, O_RDWR|O_CREAT, 0640, &s->system_metrics, s->system_journal, &f);
free(p);
if (r < 0)
@@ -2005,13 +2005,10 @@ static int system_journal_open(Server *s) {
if (!fn)
return -ENOMEM;
- r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, NULL, &s->system_journal);
+ r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, &s->system_metrics, NULL, &s->system_journal);
free(fn);
if (r >= 0) {
- journal_default_metrics(&s->system_metrics, s->system_journal->fd);
-
- s->system_journal->metrics = s->system_metrics;
s->system_journal->compress = s->compress;
server_fix_perms(s, s->system_journal, 0);
@@ -2037,7 +2034,7 @@ static int system_journal_open(Server *s) {
* if it already exists, so that we can flush
* it into the system journal */
- r = journal_file_open(fn, O_RDWR, 0640, NULL, &s->runtime_journal);
+ r = journal_file_open(fn, O_RDWR, 0640, &s->runtime_metrics, NULL, &s->runtime_journal);
free(fn);
if (r < 0) {
@@ -2053,7 +2050,7 @@ static int system_journal_open(Server *s) {
* it if necessary. */
(void) mkdir_parents(fn, 0755);
- r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, NULL, &s->runtime_journal);
+ r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, &s->runtime_metrics, NULL, &s->runtime_journal);
free(fn);
if (r < 0) {
@@ -2063,9 +2060,6 @@ static int system_journal_open(Server *s) {
}
if (s->runtime_journal) {
- journal_default_metrics(&s->runtime_metrics, s->runtime_journal->fd);
-
- s->runtime_journal->metrics = s->runtime_metrics;
s->runtime_journal->compress = s->compress;
server_fix_perms(s, s->runtime_journal, 0);