X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-vacuum.c;h=7699482a7756c13f69769bae2aea664159781c82;hb=c2fa048c4a70c8386c6d8fe939e5ea9edecf1e98;hp=b2b47d69b2af815972133869c5618fffe165dc9c;hpb=78a5d04dd61e4a4708c5c017b05724561639e657;p=elogind.git diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c index b2b47d69b..7699482a7 100644 --- a/src/journal/journal-vacuum.c +++ b/src/journal/journal-vacuum.c @@ -24,10 +24,7 @@ #include #include #include - -#ifdef HAVE_XATTR -#include -#endif +#include #include "journal-def.h" #include "journal-file.h" @@ -79,11 +76,8 @@ static void patch_realtime( unsigned long long *realtime) { usec_t x; - -#ifdef HAVE_XATTR uint64_t crtime; _cleanup_free_ const char *path = NULL; -#endif /* The timestamp was determined by the file name, but let's * see if the file might actually be older than the file name @@ -95,18 +89,17 @@ static void patch_realtime( assert(realtime); x = timespec_load(&st->st_ctim); - if (x > 0 && x != (usec_t) -1 && x < *realtime) + if (x > 0 && x != USEC_INFINITY && x < *realtime) *realtime = x; x = timespec_load(&st->st_atim); - if (x > 0 && x != (usec_t) -1 && x < *realtime) + if (x > 0 && x != USEC_INFINITY && x < *realtime) *realtime = x; x = timespec_load(&st->st_mtim); - if (x > 0 && x != (usec_t) -1 && x < *realtime) + if (x > 0 && x != USEC_INFINITY && x < *realtime) *realtime = x; -#ifdef HAVE_XATTR /* Let's read the original creation time, if possible. Ideally * we'd just query the creation time the FS might provide, but * unfortunately there's currently no sane API to query @@ -125,7 +118,6 @@ static void patch_realtime( if (crtime > 0 && crtime != (uint64_t) -1 && crtime < *realtime) *realtime = crtime; } -#endif } static int journal_file_empty(int dir_fd, const char *name) { @@ -150,7 +142,6 @@ static int journal_file_empty(int dir_fd, const char *name) { int journal_directory_vacuum( const char *directory, uint64_t max_use, - uint64_t min_free, usec_t max_retention_usec, usec_t *oldest_usec) { @@ -164,7 +155,7 @@ int journal_directory_vacuum( assert(directory); - if (max_use <= 0 && min_free <= 0 && max_retention_usec <= 0) + if (max_use <= 0 && max_retention_usec <= 0) return 0; if (max_retention_usec > 0) { @@ -301,16 +292,8 @@ int journal_directory_vacuum( qsort_safe(list, n_list, sizeof(struct vacuum_info), vacuum_compare); for (i = 0; i < n_list; i++) { - struct statvfs ss; - - if (fstatvfs(dirfd(d), &ss) < 0) { - r = -errno; - goto finish; - } - if ((max_retention_usec <= 0 || list[i].realtime >= retention_limit) && - (max_use <= 0 || sum <= max_use) && - (min_free <= 0 || (uint64_t) ss.f_bavail * (uint64_t) ss.f_bsize >= min_free)) + (max_use <= 0 || sum <= max_use)) break; if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) { @@ -335,7 +318,7 @@ finish: free(list[i].filename); free(list); - log_info("Vacuuming done, freed %"PRIu64" bytes", freed); + log_debug("Vacuuming done, freed %"PRIu64" bytes", freed); return r; }