From a3a52c0fd0c2597bf8233730c3ed3408affe0c9f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 15 Mar 2012 02:59:10 +0100 Subject: [PATCH] journald: fix calculation of disk space --- src/journal/journal-file.c | 2 +- src/journal/journald.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index a784a339..41430f31 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -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; diff --git a/src/journal/journald.c b/src/journal/journald.c index fb298be7..ee270e79 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -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; -- 2.39.5