[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
4.8.2: device/sysdep_LINUX.c
From: |
Aaron Scamehorn |
Subject: |
4.8.2: device/sysdep_LINUX.c |
Date: |
Fri, 17 Nov 2006 14:43:28 -0600 |
Hello,
In device_usage_sysdep:
I'm not quite sure what the following is supposed to be calculating:
inf->f_blocks= usage.f_blocks * usage.f_frsize / usage.f_bsize;
I think you're incorrectly mixing block size & fragment sizes. I don't
think they have anything to do with each other.
You're probably just getting lucky, because your f_frsize & f_bsize both
= 4K.
However, on large filesystems, where f_bsize might be 32K, you'll get
crazy usage numbers.
I think you just want:
inf->f_blocks= usage.f_blocks ;
Thanks,
Aaron
25 if(statvfs( dir, &usage) != 0) {
(gdb) n
(gdb) print usage
$1 = {f_bsize = 32768, f_frsize = 4096, f_blocks = 8811322, f_bfree =
8053030, f_bavail = 7605440,
f_files = 35815424, f_ffree = 35800806, f_favail = 35800806, f_fsid =
0, __f_unused = 0, f_flag = 0,
f_namemax = 255, __f_spare = {0, 0, 0, 0, 0, 0}}