diff options
author | shishir gowda <sgowda@redhat.com> | 2012-08-07 12:55:31 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-08-13 23:24:04 -0700 |
commit | e404e9b81f18c0a36a5c67ebf041ac0a00ca2eb1 (patch) | |
tree | d0d1abbbfcd100814487cb1692487a6c98989c45 /xlators/cluster/dht/src/dht-common.c | |
parent | cdf6ad3695b0842acc3d4aadc5ebb474f07e8913 (diff) |
cluster/dht: Optimize readdirp calls in DHT
Bring in option which is supported by posix xlator
to filter out directory's entries from being returned.
DHT would now request non-first subvols to filter out
directory entries.
dht xlator-option readdir-optimize will enable this
optimization
Change-Id: I35224bc81c9657f54f952efac02790276c35ded5
BUG: 838199
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.com/3772
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 5b57552c388..fbe18959a43 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2858,6 +2858,16 @@ done: goto unwind; } + if (conf->readdir_optimize == _gf_true) { + if (next_subvol != dht_first_up_subvol (this)) { + ret = dict_set_int32 (local->xattr, + GF_READDIR_SKIP_DIRS, 1); + if (ret) + gf_log (this->name, GF_LOG_ERROR, + "dict set failed"); + } + } + STACK_WIND (frame, dht_readdirp_cbk, next_subvol, next_subvol->fops->readdirp, local->fd, local->size, next_offset, @@ -2983,11 +2993,14 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, xlator_t *xvol = NULL; off_t xoff = 0; int ret = 0; + dht_conf_t *conf = NULL; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (fd, err); + conf = this->private; + local = dht_local_init (frame, NULL, NULL, whichop); if (!local) { op_errno = ENOMEM; @@ -3015,6 +3028,16 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, gf_log (this->name, GF_LOG_WARNING, "failed to set 'glusterfs.dht.linkto'" " key"); + if (conf->readdir_optimize == _gf_true) { + if (xvol != dht_first_up_subvol (this)) { + ret = dict_set_int32 (local->xattr, + GF_READDIR_SKIP_DIRS, 1); + if (ret) + gf_log (this->name, + GF_LOG_ERROR, + "Dict set failed"); + } + } } STACK_WIND (frame, dht_readdirp_cbk, xvol, xvol->fops->readdirp, |