diff options
author | Brian Foster <bfoster@redhat.com> | 2013-01-28 13:24:03 -0500 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-01-28 17:26:37 -0800 |
commit | fd9612466a8dfbfe0f918426919cf8ec135ffb4b (patch) | |
tree | 23313916e2b935babae1450f6c9b4e6468f1a96f /xlators | |
parent | fb9f29e892e762e161fc9ed72403eeaadb050077 (diff) |
performance/md-cache: add force-readdirp flag to make readdirp configurable
md-cache currently transforms all readdir fops into readdirp fops.
This patch creates the 'force-readdirp' configuration flag to
provide control over this behavior. force-readdirp is enabled by
default to maintain current default behavior.
BUG: 903175
Change-Id: Idd70926dec7c271204bdfb11fb052e56d0a39420
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4440
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 1 | ||||
-rw-r--r-- | xlators/performance/md-cache/src/md-cache.c | 32 |
2 files changed, 30 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 119dcafe771..b5666e78cba 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -209,6 +209,7 @@ static struct volopt_map_entry glusterd_volopt_map[] = { {"performance.nfs.quick-read", "performance/quick-read", "!nfsperf", "off", NO_DOC, 0, 1}, {"performance.nfs.stat-prefetch", "performance/md-cache", "!nfsperf", "off", NO_DOC, 0, 1}, {"performance.nfs.io-threads", "performance/io-threads", "!nfsperf", "off", NO_DOC, 0, 1}, + {"performance.force-readdirp", "performance/md-cache", "force-readdirp", NULL, DOC, 0, 2}, /* Quota xlator options */ {VKEY_FEATURES_LIMIT_USAGE, "features/quota", "limit-set", NULL, NO_DOC, 0, 1}, diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 9ccd655383a..0c5ca87d28c 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -32,6 +32,7 @@ struct mdc_conf { int timeout; gf_boolean_t cache_posix_acl; gf_boolean_t cache_selinux; + gf_boolean_t force_readdirp; }; @@ -1787,12 +1788,27 @@ mdc_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, return 0; } +int +mdc_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, gf_dirent_t *entries, dict_t *xdata) +{ + STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, entries, xdata); + return 0; +} int mdc_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, dict_t *xdata) { int need_unref = 0; + struct mdc_conf *conf = this->private; + + if (!conf->force_readdirp) { + STACK_WIND(frame, mdc_readdir_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->readdir, fd, size, offset, + xdata); + return 0; + } if (!xdata) { xdata = dict_new (); @@ -1802,9 +1818,9 @@ mdc_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, if (xdata) mdc_load_reqs (this, xdata); - STACK_WIND (frame, mdc_readdirp_cbk, - FIRST_CHILD (this), FIRST_CHILD (this)->fops->readdirp, - fd, size, offset, xdata); + STACK_WIND(frame, mdc_readdirp_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->readdirp, fd, size, offset, + xdata); if (need_unref && xdata) dict_unref (xdata); @@ -1866,6 +1882,8 @@ reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("cache-posix-acl", conf->cache_posix_acl, options, bool, out); mdc_key_load_set (mdc_keys, "system.posix_acl_", conf->cache_posix_acl); + GF_OPTION_RECONF("force-readdirp", conf->force_readdirp, options, bool, out); + out: return 0; } @@ -1898,6 +1916,8 @@ init (xlator_t *this) GF_OPTION_INIT ("cache-posix-acl", conf->cache_posix_acl, bool, out); mdc_key_load_set (mdc_keys, "system.posix_acl_", conf->cache_posix_acl); + + GF_OPTION_INIT("force-readdirp", conf->force_readdirp, bool, out); out: this->private = conf; @@ -1960,4 +1980,10 @@ struct volume_options options[] = { .default_value = "1", .description = "Time period after which cache has to be refreshed", }, + { .key = {"force-readdirp"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "true", + .description = "Convert all readdir requests to readdirplus to " + "collect stat info on each entry.", + }, }; |