From f90ca96f540ce1765ae25baea6205f998b005035 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Tue, 24 Jul 2012 07:08:08 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/4117 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/dht/src/dht.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index 6f16c6fc..80d00c96 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); -- cgit