diff options
author | Amar Tumballi <amar@gluster.com> | 2012-02-18 12:12:10 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-02-19 01:35:49 -0800 |
commit | 82da7e9acf6c6091599835117439260f0505d528 (patch) | |
tree | 35378f5ca92c128a1d8592f93fa816350986abe2 /xlators/cluster | |
parent | e8b6dad4dea4535a179a03824aa44628f9adaa17 (diff) |
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 <amar@gluster.com>
BUG: 290282
Reviewed-on: http://review.gluster.com/2767
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-diskusage.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c index 5453e3b107b..0200695d2c7 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, |