From 82da7e9acf6c6091599835117439260f0505d528 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Sat, 18 Feb 2012 12:12:10 +0530 Subject: cluster/distribute: send the proper 'loc_t' for statfs() in dht-diskusage.c, which was getting used for getting free disk space of all subvolumes Change-Id: Ieb2bb5f2479fac1803b9af4ef1948954a026c2ee Signed-off-by: Amar Tumballi BUG: 290282 Reviewed-on: http://review.gluster.com/2767 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/dht/src/dht-diskusage.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'xlators/cluster/dht/src/dht-diskusage.c') diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c index 5453e3b10..0200695d2 100644 --- a/xlators/cluster/dht/src/dht-diskusage.c +++ b/xlators/cluster/dht/src/dht-diskusage.c @@ -105,6 +105,7 @@ dht_get_du_info_for_subvol (xlator_t *this, int subvol_idx) call_frame_t *statfs_frame = NULL; dht_local_t *statfs_local = NULL; call_pool_t *pool = NULL; + loc_t tmp_loc = {0,}; conf = this->private; pool = this->ctx->pool; @@ -121,9 +122,8 @@ dht_get_du_info_for_subvol (xlator_t *this, int subvol_idx) goto err; } - loc_t tmp_loc = { .inode = NULL, - .path = "/", - }; + /* make it root gfid, should be enough to get the proper info back */ + tmp_loc.gfid[15] = 1; statfs_local->call_cnt = 1; STACK_WIND (statfs_frame, dht_du_info_cbk, @@ -142,15 +142,21 @@ err: int dht_get_du_info (call_frame_t *frame, xlator_t *this, loc_t *loc) { - int i = 0; + int i = 0; dht_conf_t *conf = NULL; call_frame_t *statfs_frame = NULL; dht_local_t *statfs_local = NULL; - struct timeval tv = {0,}; + struct timeval tv = {0,}; + loc_t tmp_loc = {0,}; conf = this->private; gettimeofday (&tv, NULL); + + /* make it root gfid, should be enough to get the proper + info back */ + tmp_loc.gfid[15] = 1; + if (tv.tv_sec > (conf->refresh_interval + conf->last_stat_fetch.tv_sec)) { @@ -166,10 +172,6 @@ dht_get_du_info (call_frame_t *frame, xlator_t *this, loc_t *loc) goto err; } - loc_t tmp_loc = { .inode = NULL, - .path = "/", - }; - statfs_local->call_cnt = conf->subvolume_cnt; for (i = 0; i < conf->subvolume_cnt; i++) { STACK_WIND (statfs_frame, dht_du_info_cbk, -- cgit