]> err.no Git - systemd/commitdiff
journald: fix calculation of disk space
authorLennart Poettering <lennart@poettering.net>
Thu, 15 Mar 2012 01:59:10 +0000 (02:59 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 15 Mar 2012 02:01:09 +0000 (03:01 +0100)
src/journal/journal-file.c
src/journal/journald.c

index a784a3391b9271cdfc7b612957e9570ec1146ec7..41430f310d88d5b96438023947fbf0abf45063ef 100644 (file)
@@ -2068,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;
index fb298be758f91058028feb46aa140becfcc6485b..ee270e79af8a24b25912d6fafee7d8b48c9595c5 100644 (file)
@@ -171,7 +171,10 @@ static uint64_t available_space(Server *s) {
                 if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0)
                         continue;
 
-                sum += (uint64_t) st.st_blocks * (uint64_t) st.st_blksize;
+                if (!S_ISREG(st.st_mode))
+                        continue;
+
+                sum += (uint64_t) st.st_blocks * 512UL;
         }
 
         avail = sum >= m->max_use ? 0 : m->max_use - sum;