diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2011-05-30 03:42:50 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-05-31 10:17:54 -0700 |
commit | dd476eb4678df02ff22f9aa7db7453f857721c42 (patch) | |
tree | d0da129b6275fddf8be9ebb8a25f38fde034619c /xlators/cluster | |
parent | 8b53f87878d0eae5bab521d3d429ca19ea903d9a (diff) |
stripe: changes to print stripe information in statedump
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2958 (stripe information is not printed in statedump)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2958
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index d60c3cdc20c..aa572471299 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -36,6 +36,7 @@ #include "stripe.h" #include "libxlator.h" #include "byte-order.h" +#include "statedump.h" void stripe_local_wipe (stripe_local_t *local) @@ -4391,7 +4392,66 @@ err: return 0; } +int32_t +stripe_priv_dump (xlator_t *this) +{ + char key_prefix[GF_DUMP_MAX_BUF_LEN]; + char key[GF_DUMP_MAX_BUF_LEN]; + int i = 0; + stripe_private_t *priv = NULL; + int ret = -1; + struct stripe_options *options = NULL; + + GF_VALIDATE_OR_GOTO ("stripe", this, out); + + priv = this->private; + if (!priv) + goto out; + + ret = TRY_LOCK (&priv->lock); + if (ret != 0) + goto out; + + gf_proc_dump_add_section("xlator.cluster.stripe.%s.priv", this->name); + gf_proc_dump_build_key(key_prefix,"xlator.cluster.stripe","%s.priv", + this->name); + gf_proc_dump_build_key(key, key_prefix, "child_count"); + gf_proc_dump_write(key,"%d", priv->child_count); + + for (i = 0; i < priv->child_count; i++) { + gf_proc_dump_build_key (key, key_prefix, "subvolumes[%d]", i); + gf_proc_dump_write (key, "%s.%s", priv->xl_array[i]->type, + priv->xl_array[i]->name); + } + + options = priv->pattern; + while (options != NULL) { + gf_proc_dump_build_key (key, key_prefix, "path_pattern"); + gf_proc_dump_write (key, "%s", priv->pattern->path_pattern); + gf_proc_dump_build_key (key, key_prefix, "options_block_size"); + gf_proc_dump_write (key, "%ul", options->block_size); + + options = options->next; + } + + gf_proc_dump_build_key (key, key_prefix, "block_size"); + gf_proc_dump_write (key, "%ul", priv->block_size); + + gf_proc_dump_build_key (key, key_prefix, "nodes_down"); + gf_proc_dump_write (key, "%d", priv->nodes_down); + + gf_proc_dump_build_key (key, key_prefix, "first_child_down"); + gf_proc_dump_write (key, "%d", priv->first_child_down); + + gf_proc_dump_build_key (key, key_prefix, "xatter_supported"); + gf_proc_dump_write (key, "%d", priv->xattr_supported); + + UNLOCK (&priv->lock); + +out: + return ret; +} struct xlator_fops fops = { .stat = stripe_stat, @@ -4426,6 +4486,9 @@ struct xlator_cbks cbks = { .release = stripe_release, }; +struct xlator_dumpops dumpops = { + .priv = stripe_priv_dump, +}; struct volume_options options[] = { { .key = {"block-size"}, |