Hello list.
On FreeBSD f_bsize of struct statvfs is not equal to the filesystems
blocksize as on Linux, on FreeBSD f_bsize is statfs's f_iosize which is
optimal transfer block size e.g can be much larger than fragment size and
actual block size.
Therefore also use f_frsize for freeval calculation. This fixes the issue
on FreeBSD
where the dir status storage reports Available Space incorrectly.
It applies both to Bacula 7 and Bacula 9. (I only tested on 9 but they seem
to have bsys.c in common on this matter) I have only tested on my FreeBSD
box and with the fix it reports Available Space correctly (tested with ufs
and zfs)
--- src/lib/bsys.c.orig
+++ src/lib/bsys.c
@@ -1033,7 +1033,7 @@ int fs_get_free_space(const char *path,
struct statvfs st;
if (statvfs(path, &st) == 0) {
- *freeval = (uint64_t)st.f_bsize * (uint64_t)st.f_bavail;
+ *freeval = (uint64_t)st.f_frsize * (uint64_t)st.f_bavail;
*totalval = (uint64_t)st.f_blocks * (uint64_t)st.f_frsize;
return 0;
}
Or less confusing starting both calculations with the fs block
size/fragment size:
*freeval = (uint64_t)st.f_frsize * (uint64_t)st.f_bavail;
*totalval =(uint64_t)st.f_frsize * (uint64_t)st.f_blocks;
Regards
/Jesper Schmitz Mouridsen.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel