[systemd-devel] [PATCH] Fix vacuum logic error

Jan Alexander Steffens (heftig) jan.steffens at gmail.com
Wed Mar 20 13:32:05 PDT 2013


From: "Jan Alexander Steffens (heftig)" <jan.steffens at gmail.com>

The vacuum code used to stop vacuuming after one deletion, even
when max_use was still exceeded.

Also make usage a uint64_t, as the code already pretends it is one.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens at gmail.com>
---
 src/journal/journal-vacuum.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 731f6c7..4a3a5a9 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -36,7 +36,7 @@
 #include "util.h"
 
 struct vacuum_info {
-        off_t usage;
+        uint64_t usage;
         char *filename;
 
         uint64_t realtime;
@@ -293,7 +293,7 @@ int journal_directory_vacuum(
                 if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
                         log_debug("Deleted archived journal %s/%s.", directory, list[i].filename);
 
-                        if ((uint64_t) list[i].usage > sum)
+                        if (list[i].usage < sum)
                                 sum -= list[i].usage;
                         else
                                 sum = 0;
-- 
1.8.2



More information about the systemd-devel mailing list