From: Lennart Poettering Date: Fri, 30 Dec 2011 23:57:14 +0000 (+0100) Subject: journal: move max_use into metrics structure X-Git-Tag: v38~144^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74ef2d16ada74db3059d825ce8d24ea74946bf8f;p=systemd journal: move max_use into metrics structure --- diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h index ab2970ca..acc55272 100644 --- a/src/journal/journal-file.h +++ b/src/journal/journal-file.h @@ -28,7 +28,7 @@ #include "util.h" #include "sd-id128.h" -#define DEFAULT_MAX_SIZE (1024ULL*128ULL) +#define DEFAULT_MAX_SIZE (128ULL*1024ULL*1024ULL) #define DEFAULT_MIN_SIZE (256ULL*1024ULL) #define DEFAULT_KEEP_FREE (1ULL*1024ULL*1024ULL) #define DEFAULT_MAX_USE (16ULL*1024ULL*1024ULL*16ULL) @@ -54,6 +54,7 @@ typedef struct JournalMetrics { uint64_t max_size; uint64_t min_size; uint64_t keep_free; + uint64_t max_use; } JournalMetrics; typedef struct JournalFile { diff --git a/src/journal/journald.c b/src/journal/journald.c index a25f81ef..78ccb4e0 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -76,7 +76,6 @@ typedef struct Server { JournalRateLimit *rate_limit; JournalMetrics metrics; - uint64_t max_use; bool compress; uint64_t cached_available_space; @@ -176,7 +175,7 @@ static uint64_t available_space(Server *s) { sum += (uint64_t) st.st_blocks * (uint64_t) st.st_blksize; } - avail = sum >= s->max_use ? 0 : s->max_use - sum; + avail = sum >= s->metrics.max_use ? 0 : s->metrics.max_use - sum; ss_avail = ss.f_bsize * ss.f_bavail; @@ -341,7 +340,7 @@ static void server_vacuum(Server *s) { return; } - r = journal_directory_vacuum(p, s->max_use, s->metrics.keep_free); + r = journal_directory_vacuum(p, s->metrics.max_use, s->metrics.keep_free); if (r < 0 && r != -ENOENT) log_error("Failed to vacuum %s: %s", p, strerror(-r)); free(p); @@ -351,7 +350,7 @@ static void server_vacuum(Server *s) { return; } - r = journal_directory_vacuum(p, s->max_use, s->metrics.keep_free); + r = journal_directory_vacuum(p, s->metrics.max_use, s->metrics.keep_free); if (r < 0 && r != -ENOENT) log_error("Failed to vacuum %s: %s", p, strerror(-r)); free(p); @@ -1721,7 +1720,7 @@ static int server_init(Server *s) { s->metrics.max_size = DEFAULT_MAX_SIZE; s->metrics.min_size = DEFAULT_MIN_SIZE; s->metrics.keep_free = DEFAULT_KEEP_FREE; - s->max_use = DEFAULT_MAX_USE; + s->metrics.max_use = DEFAULT_MAX_USE; s->compress = true; s->user_journals = hashmap_new(trivial_hash_func, trivial_compare_func);