Add further debug output concerning disk usage when debug.gc=true

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2024-03-31 12:21:21 +02:00
parent 58ca959cf2
commit df1f70dd09
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
2 changed files with 34 additions and 0 deletions

View File

@ -1206,6 +1206,23 @@ void log_resource_shortage(const double load, const int nprocs, const int shmem,
// Get filesystem details for this path
struct mntent *fsdetails = get_filesystem_details(path);
// Log filesystem details if in debug mode
if(config.debug.gc.v.b)
{
if(fsdetails != NULL)
{
log_debug(DEBUG_GC, "Disk details for path \"%s\":", path);
log_debug(DEBUG_GC, " Device or server for filesystem: %s", fsdetails->mnt_fsname);
log_debug(DEBUG_GC, " Directory mounted on: %s", fsdetails->mnt_dir);
log_debug(DEBUG_GC, " Type of filesystem: %s", fsdetails->mnt_type);
log_debug(DEBUG_GC, " Comma-separated options for fs: %s", fsdetails->mnt_opts);
log_debug(DEBUG_GC, " Dump frequency (in days): %d", fsdetails->mnt_freq);
log_debug(DEBUG_GC, " Pass number for `fsck': %d", fsdetails->mnt_passno);
}
else
log_debug(DEBUG_GC, "Failed to get filesystem details for path \"%s\"", path);
}
// Create plain message
if(fsdetails != NULL)
format_disk_message_extended(buf, sizeof(buf), NULL, 0, disk, msg, fsdetails->mnt_type, fsdetails->mnt_dir);

View File

@ -252,6 +252,23 @@ unsigned int get_path_usage(const char *path, char buffer[64])
const unsigned long long free = (unsigned long long)f.f_bavail * f.f_bsize;
const unsigned long long used = size - free;
// Print statvfs() results if in debug.gc mode
if(config.debug.gc.v.b)
{
log_debug(DEBUG_GC, "Statvfs() results for %s:", path);
log_debug(DEBUG_GC, " Block size: %lu", f.f_bsize);
log_debug(DEBUG_GC, " Fragment size: %lu", f.f_frsize);
log_debug(DEBUG_GC, " Total blocks: %lu", f.f_blocks);
log_debug(DEBUG_GC, " Free blocks: %lu", f.f_bfree);
log_debug(DEBUG_GC, " Available blocks: %lu", f.f_bavail);
log_debug(DEBUG_GC, " Total inodes: %lu", f.f_files);
log_debug(DEBUG_GC, " Free inodes: %lu", f.f_ffree);
log_debug(DEBUG_GC, " Available inodes: %lu", f.f_favail);
log_debug(DEBUG_GC, " Filesystem ID: %lu", f.f_fsid);
log_debug(DEBUG_GC, " Mount flags: %lu", f.f_flag);
log_debug(DEBUG_GC, " Maximum filename length: %lu", f.f_namemax);
}
// Create human-readable total size
char prefix_size[2] = { 0 };
double formatted_size = 0.0;