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>
This commit is contained in:
Raghavendra Bhat 2012-07-24 07:08:08 +05:30 committed by Vijay Bellur
parent 2100ebd982
commit f90ca96f54

View File

@ -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);