diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2012-07-24 07:08:08 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-19 02:58:06 -0800 |
commit | f90ca96f540ce1765ae25baea6205f998b005035 (patch) | |
tree | b2bf56e4d8c742cf16bddc1f652ade208315295b /xlators/cluster/dht/src/dht.c | |
parent | 2100ebd982d09950a84a0d6ae25770ca17e6689c (diff) |
cluster/dht: dump the layout information of directories only
testcase:
The changes are for removing gf_log from statedump related sections in dht and
using pthread_mutex_trylock in statedump sections. Changes are internal. So
tests were done by attaching gdb to the process and executing by manually
changing the values of some of the pointers.
Change-Id: I41fa76c1812b462cb76f5bbf2fd14de080e73895
BUG: 843822
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4117
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht.c')
-rw-r--r-- | xlators/cluster/dht/src/dht.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index 6f16c6fcc18..80d00c96b55 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -34,8 +34,10 @@ dht_layout_dump (dht_layout_t *layout, const char *prefix) char key[GF_DUMP_MAX_BUF_LEN]; int i = 0; - GF_VALIDATE_OR_GOTO ("dht", layout, out); - GF_VALIDATE_OR_GOTO ("dht", prefix, out); + if (!layout) + goto out; + if (!prefix) + goto out; gf_proc_dump_build_key(key, prefix, "cnt"); gf_proc_dump_write(key, "%d", layout->cnt); @@ -43,8 +45,13 @@ dht_layout_dump (dht_layout_t *layout, const char *prefix) gf_proc_dump_write(key, "%d", layout->preset); gf_proc_dump_build_key(key, prefix, "gen"); gf_proc_dump_write(key, "%d", layout->gen); - gf_proc_dump_build_key(key, prefix, "type"); - gf_proc_dump_write(key, "%d", layout->type); + if (layout->type != IA_INVAL) { + gf_proc_dump_build_key(key, prefix, "inode type"); + gf_proc_dump_write(key, "%d", layout->type); + } + + if (!IA_ISDIR (layout->type)) + goto out; for (i = 0; i < layout->cnt; i++) { gf_proc_dump_build_key(key, prefix,"list[%d].err", i); @@ -79,12 +86,12 @@ dht_priv_dump (xlator_t *this) dht_conf_t *conf = NULL; int ret = -1; - GF_VALIDATE_OR_GOTO ("dht", this, out); + if (!this) + goto out; conf = this->private; - if (!conf) - return -1; + goto out; ret = TRY_LOCK(&conf->subvolume_lock); if (ret != 0) { @@ -149,8 +156,10 @@ dht_inodectx_dump (xlator_t *this, inode_t *inode) int ret = -1; dht_layout_t *layout = NULL; - GF_VALIDATE_OR_GOTO ("dht", this, out); - GF_VALIDATE_OR_GOTO ("dht", inode, out); + if (!this) + goto out; + if (!inode) + goto out; ret = dht_inode_ctx_layout_get (inode, this, &layout); |