From a40c52707762258eddb35a63ee1f78bc4e0a52dd Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Wed, 6 Jul 2011 03:10:05 +0000 Subject: dht disk usage: Correct free blk calculation Use f_bavial instead of f_bfree for %free calculation This fixes mismatch of df output wrt backend and glusterfs where: f_bfree = /* # free blocks */ f_bavail; /* free blocks avail to non-superuser */ Signed-off-by: shishir gowda Signed-off-by: Anand Avati BUG: 3084 (Correcting percent calculation of disk space) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3084 --- xlators/cluster/dht/src/dht-diskusage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c index 75953781e..2ff470ec8 100644 --- a/xlators/cluster/dht/src/dht-diskusage.c +++ b/xlators/cluster/dht/src/dht-diskusage.c @@ -54,8 +54,8 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } if (statvfs && statvfs->f_blocks) { - percent = (statvfs->f_bfree * 100) / statvfs->f_blocks; - bytes = (statvfs->f_bfree * statvfs->f_frsize); + percent = (statvfs->f_bavail * 100) / statvfs->f_blocks; + bytes = (statvfs->f_bavail * statvfs->f_frsize); } LOCK (&conf->subvolume_lock); -- cgit