diff options
author | Michael Goulet <mgoulet@fb.com> | 2017-08-15 16:50:13 -0700 |
---|---|---|
committer | Shreyas Siravara <sshreyas@fb.com> | 2017-09-07 23:02:56 +0000 |
commit | dbd30776f26e9c3c0ce1cf8ad66ee95fc1adf484 (patch) | |
tree | 109737d0655931ee598eac9c5211857de28cfa92 /libglusterfs/src | |
parent | 7981d5147feca3f459dd5377dc92cc5a3e6ad953 (diff) |
features/namespace: Add namespace xlator and link into brick graph
Summary:
This translator tags namespaces with a unique hash that corresponds to the
top-level directory (right under the gluster root) of the file the fop acts
on. The hash information is injected into the call frame by this translator,
so this namespace information can later be used to do throttling, QoS and
other namespace-specific stats collection and actions in later xlators
further down the stack.
When the translator can't find a path directly for the fd_t or loc_t, it winds
a GET_ANCESTRY_PATH_KEY down to the posix xlator to get the path manually.
Caching this namespace information in the inode makes sure that most requests
don't need to recalculate the hash, so that typically fops are just doing an
inode_ctx_get instead of the more expensive code paths that this xlator can take.
Right now the xlator is hard-coded to only hash the top-level directory, but
this could be easily extended to more sophisticated matching by modification
of the parse_path function.
Test Plan:
Run `prove -v tests/basic/namespace.t` to see that tagging works.
Change-Id: I960ddadba114120ac449d27a769d409cc3759ebc
Reviewed-on: https://review.gluster.org/18041
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/stack.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 393fdac8e73..9e5355a6044 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -32,6 +32,7 @@ typedef struct call_pool call_pool_t; #include "globals.h" #include "lkowner.h" #include "client_t.h" +#include "fd.h" #include "libglusterfs-messages.h" #define NFS_PID 1 @@ -78,6 +79,13 @@ struct _call_frame_t { const char *unwind_to; }; +struct _ns_info { + uint32_t hash; /* Hash of the namespace from SuperFastHash */ + gf_boolean_t found; /* Set to true if we found a namespace */ +}; + +typedef struct _ns_info ns_info_t; + #define SMALL_GROUP_COUNT 128 struct _call_stack_t { @@ -110,6 +118,8 @@ struct _call_stack_t { int32_t op; int8_t type; struct timeval tv; + + ns_info_t ns_info; }; |