summaryrefslogtreecommitdiffstats
path: root/xlators/features/namespace/src
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@fb.com>2017-09-15 06:59:01 -0700
committerJeff Darcy <jdarcy@fb.com>2017-09-15 13:47:01 -0700
commit8dfdecf220d1c9365e1f8d6af9ead5e48c61e2eb (patch)
treebccd5906be43cf81792248b06099006525ed0c27 /xlators/features/namespace/src
parente4b47b5d54644c398c424a99116a0cc37e4431d6 (diff)
Replace namespace/io-stats/io-threads with 3.6-fb versions
This rolls up multiple patches related to namespace identificaton and throttling/QoS. This primarily includes the following, all by Michael Goulet <mgoulet@fb.com>. io-threads: Add weighted round robin queueing by namespace https://phabricator.facebook.com/D5615269 io-threads: Add per-namespaces queue sizes to IO_THREADS_QUEUE_SIZE_KEY https://phabricator.facebook.com/D5683162 io-threads: Implement better slot allocation algorithm https://phabricator.facebook.com/D5683186 io-threads: Only enable weighted queueing on bricks https://phabricator.facebook.com/D5700062 io-threads: Update queue sizes on drain https://phabricator.facebook.com/D5704832 Fix parsing (-1) as default NS weight https://phabricator.facebook.com/D5723383 Parts of the following patches have also been applied to satisfy dependencies. io-throttling: Calculate moving averages and throttle offending hosts https://phabricator.fb.com/D2516161 Shreyas Siravara <sshreyas@fb.com> Hook up ODS logging for FUSE clients. https://phabricator.facebook.com/D3963376 Kevin Vigor <kvigor@fb.com> Add the flag --skip-nfsd-start to skip the NFS daemon stating, even if it is enabled https://phabricator.facebook.com/D4575368 Alex Lorca <alexlorca@fb.com> There are also some "standard" changes: dealing with code that moved, reindenting to comply with Gluster coding standards, gf_uuid_xxx, etc. This patch *does* revert some changes which have occurred upstream since 3.6; these will be re-applied as apppropriate on top of this new base. Change-Id: I69024115da7a60811e5b86beae781d602bdb558d Signed-off-by: Jeff Darcy <jdarcy@fb.com>
Diffstat (limited to 'xlators/features/namespace/src')
-rw-r--r--xlators/features/namespace/src/namespace.c77
-rw-r--r--xlators/features/namespace/src/namespace.h1
2 files changed, 62 insertions, 16 deletions
diff --git a/xlators/features/namespace/src/namespace.c b/xlators/features/namespace/src/namespace.c
index 639dfa33fe2..4585087025e 100644
--- a/xlators/features/namespace/src/namespace.c
+++ b/xlators/features/namespace/src/namespace.c
@@ -143,7 +143,7 @@ ns_inode_ctx_put (inode_t *inode, xlator_t *this, ns_info_t *info)
int ret = -1;
if (!inode || !this) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_log (this->name, GF_LOG_DEBUG,
"Need a valid inode and xlator to cache ns_info.");
ret = -1;
goto out;
@@ -253,10 +253,10 @@ get_path_resume_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
"G>P %s %10u namespace found %s",
uuid_utoa (local->loc.inode->gfid), info->hash, path);
} else if (ret == PATH_PARSE_RESULT_NO_PATH) {
- gf_log (this->name, GF_LOG_WARNING, "G>P %s has no path",
+ gf_log (this->name, GF_LOG_DEBUG, "G>P %s has no path",
uuid_utoa (local->loc.inode->gfid));
} else if (ret == PATH_PARSE_RESULT_IS_GFID) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_log (this->name, GF_LOG_DEBUG,
"G>P %s winding failed, still have gfid",
uuid_utoa (local->loc.inode->gfid));
}
@@ -303,16 +303,26 @@ set_ns_from_loc (const char *fn, call_frame_t *frame, xlator_t *this, loc_t *loc
* from the inode context, then from the loc's path itself. */
if (!loc || !loc->path || !loc->inode) {
ret = PATH_PARSE_RESULT_NO_PATH;
- } else if (!ns_inode_ctx_get (loc->inode, this, info)) {
+ goto out;
+ }
+
+ if (!ns_inode_ctx_get (loc->inode, this, info)) {
ret = PATH_PARSE_RESULT_FOUND;
- } else {
- ret = parse_path (info, loc->path);
- gf_log (this->name, GF_LOG_DEBUG, "%s: LOC retrieved path %s",
- fn, loc->path);
+ goto out;
+ }
- if (ret == PATH_PARSE_RESULT_FOUND) {
- ns_inode_ctx_put (loc->inode, this, info);
- }
+ if (gf_uuid_is_null (loc->inode->gfid) && gf_uuid_is_null (loc->gfid)) {
+ ret = PATH_PARSE_RESULT_NO_PATH;
+ goto out;
+ }
+
+ ret = parse_path (info, loc->path);
+ gf_log (this->name, GF_LOG_DEBUG, "%s: LOC retrieved path %s",
+ fn, loc->path);
+
+ if (ret == PATH_PARSE_RESULT_FOUND) {
+ ns_inode_ctx_put (loc->inode, this, info);
+ goto out;
}
/* Keep trying by calling inode_path next, making sure to copy
@@ -337,6 +347,7 @@ set_ns_from_loc (const char *fn, call_frame_t *frame, xlator_t *this, loc_t *loc
}
}
+out:
/* Report our status, and if we have a GFID, we'll eventually try a
* GET_ANCESTRY_PATH_KEY wind when we return from this function. */
if (ret == PATH_PARSE_RESULT_FOUND) {
@@ -344,7 +355,7 @@ set_ns_from_loc (const char *fn, call_frame_t *frame, xlator_t *this, loc_t *loc
"%s: LOC %s %10u namespace found for %s", fn,
uuid_utoa (loc->inode->gfid), info->hash, loc->path);
} else if (ret == PATH_PARSE_RESULT_NO_PATH) {
- gf_log (this->name, GF_LOG_WARNING, "%s: LOC has no path", fn);
+ gf_log (this->name, GF_LOG_DEBUG, "%s: LOC has no path", fn);
} else if (ret == PATH_PARSE_RESULT_IS_GFID) {
/* Make sure to copy the inode's gfid for the eventual wind. */
if (gf_uuid_is_null (loc->inode->gfid)) {
@@ -381,9 +392,20 @@ set_ns_from_fd (const char *fn, call_frame_t *frame, xlator_t *this, fd_t *fd)
* from the inode context, then inode_path. */
if (!fd || !fd->inode) {
ret = PATH_PARSE_RESULT_NO_PATH;
- } else if (!ns_inode_ctx_get (fd->inode, this, info)) {
+ goto out;
+ }
+
+ if (!ns_inode_ctx_get (fd->inode, this, info)) {
ret = PATH_PARSE_RESULT_FOUND;
- } else if (inode_path (fd->inode, NULL, &path) >= 0 && path) {
+ goto out;
+ }
+
+ if (gf_uuid_is_null (fd->inode->gfid)) {
+ ret = PATH_PARSE_RESULT_NO_PATH;
+ goto out;
+ }
+
+ if (inode_path (fd->inode, NULL, &path) >= 0 && path) {
ret = parse_path (info, path);
gf_log (this->name, GF_LOG_DEBUG, "%s: FD retrieved path %s",
fn, path);
@@ -397,13 +419,14 @@ set_ns_from_fd (const char *fn, call_frame_t *frame, xlator_t *this, fd_t *fd)
GF_FREE (path);
}
+out:
/* Report our status, and if we have a GFID, we'll eventually try a
* GET_ANCESTRY_PATH_KEY wind when we return from this function. */
if (ret == PATH_PARSE_RESULT_FOUND) {
gf_log (this->name, GF_LOG_DEBUG, "%s: FD %s %10u namespace found",
fn, uuid_utoa (fd->inode->gfid), info->hash);
} else if (ret == PATH_PARSE_RESULT_NO_PATH) {
- gf_log (this->name, GF_LOG_WARNING, "%s: FD has no path", fn);
+ gf_log (this->name, GF_LOG_DEBUG, "%s: FD has no path", fn);
} else if (ret == PATH_PARSE_RESULT_IS_GFID) {
gf_log (this->name, GF_LOG_DEBUG,
"%s: FD %s winding, looking for path",
@@ -442,6 +465,12 @@ set_ns_from_fd (const char *fn, call_frame_t *frame, xlator_t *this, fd_t *fd)
goto wind; \
} \
\
+ if (gf_uuid_is_null (inode->gfid)) { \
+ gf_log (this->name, GF_LOG_DEBUG, \
+ "Cannot wind on a NULL GFID."); \
+ goto wind; \
+ } \
+ \
new_frame->root->uid = new_frame->root->gid = 0; \
/* Put a phony "not found" NS info into this call. */ \
new_frame->root->ns_info = *info; \
@@ -750,8 +779,10 @@ wind:
int32_t
ns_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
+ ns_private_t *priv = (ns_private_t *)this->private;
+
path_parse_result_t ret = set_ns_from_loc (__FUNCTION__, frame, this, loc);
- if (ret == PATH_PARSE_RESULT_IS_GFID) {
+ if (ret == PATH_PARSE_RESULT_IS_GFID && priv->wind_lookups) {
GET_ANCESTRY_PATH_WIND (lookup, loc->inode, loc, xdata);
return 0;
}
@@ -1229,6 +1260,7 @@ init (xlator_t *this)
}
GF_OPTION_INIT ("tag-namespaces", priv->tag_namespaces, bool, out);
+ GF_OPTION_INIT ("wind-lookups", priv->wind_lookups, bool, out);
gf_log (this->name, GF_LOG_INFO, "Namespace xlator loaded");
this->private = priv;
@@ -1262,6 +1294,8 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("tag-namespaces", priv->tag_namespaces, options, bool,
out);
+ GF_OPTION_RECONF ("wind-lookups", priv->wind_lookups, options,
+ bool, out);
ret = 0;
out:
@@ -1331,5 +1365,16 @@ struct volume_options options[] = {
"that tags every fop with a namespace hash for later "
"throttling, stats collection, logging, etc.",
},
+ {
+ .key = { "wind-lookups" },
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "on",
+ .description = "If enabled, a GET_ANCESTRY_PATH_KEY getxattr wind "
+ "will be scheduled for a LOOKUP. Since we have many "
+ "LOOKUP requests which are sent for files that don't "
+ "exist, it's often benificial to disable this option, "
+ "so we don't have a high percentage of bad GETXATTRs "
+ "in io-stats.",
+ },
{.key = { NULL } },
};
diff --git a/xlators/features/namespace/src/namespace.h b/xlators/features/namespace/src/namespace.h
index 3b9f782cb1a..affaba04681 100644
--- a/xlators/features/namespace/src/namespace.h
+++ b/xlators/features/namespace/src/namespace.h
@@ -13,6 +13,7 @@
typedef struct {
gf_boolean_t tag_namespaces;
+ gf_boolean_t wind_lookups;
} ns_private_t;
typedef struct {