@cryptotaxi247 / netdata-1 / commits / 46b1bd89a

Improve free disk space calculation for Windows (#21121)

Stelios Fragkakis committed Oct 9, 2025 at 16:15 UTC 46b1bd89a3d053926958c6a04ed44785d458fc5d
1 file changed +2 -4
src/database/engine/rrdengine.c
+2 -4
@@ -2294,10 +2294,8 @@ static inline void worker_dispatch_query_prep(struct rrdeng_cmd cmd, bool from_w
2294 uint64_t rrdeng_get_directory_free_bytes_space(struct rrdengine_instance *ctx)
2295 {
2296 uint64_t free_bytes = 0;
2297 - struct statvfs buff_statvfs;
2298 - if (statvfs(ctx->config.dbfiles_path, &buff_statvfs) == 0)
2299 - free_bytes = buff_statvfs.f_bavail * buff_statvfs.f_bsize;
2300 -
2297 + OS_SYSTEM_DISK_SPACE space = os_disk_space(ctx->config.dbfiles_path);
2298 + free_bytes = OS_SYSTEM_DISK_SPACE_OK(space) ? space.free_bytes : 0;
2299 return (free_bytes - (free_bytes * 5 / 100));
2300 }
2301