diff options
author | Amar Tumballi <amar@gluster.com> | 2011-05-26 07:45:49 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-05-31 05:11:09 -0700 |
commit | d7497c4f1b361b1d1c42c157cbcf7ce8bc16fd44 (patch) | |
tree | 9a7b608451911e017c2e8bae17f510ea86c150ad /xlators | |
parent | 411aa2902d304495a4a374a09b767e588b330e88 (diff) |
statfs(): honor the 'inode' on which the statfs() call is made
fuse-bridge : fill the 'loc' properly with correct 'inode'.
dht : if directory, send statfs() to all subvol, else send it to only
cached subvol.
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2258 (enhance gluster volume rebalance)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2258
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 33 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 2 |
2 files changed, 28 insertions, 7 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 35b273e8875..8fa93fa076b 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2727,12 +2727,12 @@ unlock: int dht_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) { + xlator_t *subvol = NULL; dht_local_t *local = NULL; dht_conf_t *conf = NULL; int op_errno = -1; int i = -1; - VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (loc, err); @@ -2743,14 +2743,35 @@ dht_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) conf = this->private; local = dht_local_init (frame); - local->call_cnt = conf->subvolume_cnt; + if (!local) { + op_errno = ENOMEM; + goto err; + } - for (i = 0; i < conf->subvolume_cnt; i++) { - STACK_WIND (frame, dht_statfs_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->statfs, loc); + if (IA_ISDIR (loc->inode->ia_type)) { + local->call_cnt = conf->subvolume_cnt; + + for (i = 0; i < conf->subvolume_cnt; i++) { + STACK_WIND (frame, dht_statfs_cbk, + conf->subvolumes[i], + conf->subvolumes[i]->fops->statfs, loc); + } + return 0; + } + + subvol = dht_subvol_get_cached (this, loc->inode); + if (!subvol) { + gf_log (this->name, GF_LOG_DEBUG, + "no cached subvolume for path=%s", loc->path); + op_errno = EINVAL; + goto err; } + local->call_cnt = 1; + + STACK_WIND (frame, dht_statfs_cbk, + subvol, subvol->fops->statfs, loc); + return 0; err: diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index dafc0a93cd3..a4ab749a3f2 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2291,7 +2291,7 @@ fuse_statfs (xlator_t *this, fuse_in_header_t *finh, void *msg) int32_t ret = -1; GET_STATE (this, finh, state); - ret = fuse_loc_fill (&state->loc, state, 1, 0, NULL); + ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, NULL); if ((state->loc.inode == NULL) || (ret < 0)) { gf_log ("glusterfs-fuse", GF_LOG_WARNING, |