chiark / gitweb /
journald: fix calculation of disk space
[elogind.git] / src / journal / journal-file.c
index c3b56ddc87d0d25439f8cc80495ab996024500cf..41430f310d88d5b96438023947fbf0abf45063ef 100644 (file)
@@ -48,7 +48,7 @@
 #define DEFAULT_MAX_USE_UPPER (4ULL*1024ULL*1024ULL*1024ULL)   /* 4 GiB */
 
 /* This is the upper bound if we deduce max_size from max_use */
-#define DEFAULT_MAX_SIZE_UPPER (16ULL*1024ULL*1024ULL)         /* 16 MiB */
+#define DEFAULT_MAX_SIZE_UPPER (128ULL*1024ULL*1024ULL)        /* 128 MiB */
 
 /* This is the upper bound if we deduce the keep_free value from the
  * file system size */
@@ -1740,6 +1740,11 @@ int journal_file_open(
         f->writable = (flags & O_ACCMODE) != O_RDONLY;
         f->prot = prot_from_flags(flags);
 
+        if (template) {
+                f->metrics = template->metrics;
+                f->compress = template->compress;
+        }
+
         f->path = strdup(fname);
         if (!f->path) {
                 r = -ENOMEM;
@@ -2063,7 +2068,7 @@ int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t m
                 }
 
                 list[n_list].filename = p;
-                list[n_list].usage = (uint64_t) st.st_blksize * (uint64_t) st.st_blocks;
+                list[n_list].usage = 512UL * (uint64_t) st.st_blocks;
                 list[n_list].seqnum = seqnum;
                 list[n_list].realtime = realtime;
                 list[n_list].seqnum_id = seqnum_id;