summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2009-09-15 04:47:50 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-16 07:11:37 -0700
commit9fd8f212bc1f6031b9ad7eaaf014d39916881947 (patch)
tree788a6950630ee1df028c9d5cddecee038fe9fc49
parentdcfc4bdd5962ad18665d9ad3f3309884c941845e (diff)
Dumop inodectx added
Added dumpop inodectx. Support for dumop inodectx added in dht, locks and client-protocol. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 213 (Support for process state dump) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=213
-rw-r--r--libglusterfs/src/inode.c15
-rw-r--r--libglusterfs/src/xlator.h3
-rw-r--r--xlators/cluster/dht/src/dht.c29
-rw-r--r--xlators/features/locks/src/posix.c26
-rw-r--r--xlators/protocol/client/src/client-protocol.c28
5 files changed, 88 insertions, 13 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 06f742cc6..ff65d101e 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1213,6 +1213,8 @@ inode_dump (inode_t *inode, char *prefix)
{
char key[GF_DUMP_MAX_BUF_LEN];
int ret = -1;
+ xlator_t *xl = NULL;
+ int i = 0;
if (!inode)
return;
@@ -1236,6 +1238,19 @@ inode_dump (inode_t *inode, char *prefix)
gf_proc_dump_build_key(key, prefix, "st_mode");
gf_proc_dump_write(key, "%d", inode->st_mode);
UNLOCK(&inode->lock);
+ if (!inode->_ctx)
+ goto out;
+
+ for (i = 0; i < inode->table->xl->ctx->xl_count; i++) {
+ if (inode->_ctx[i].key) {
+ xl = (xlator_t *)(long)inode->_ctx[i].key;
+ if (xl->dumpops && xl->dumpops->inodectx)
+ xl->dumpops->inodectx (xl, inode);
+ }
+ }
+
+out:
+ return;
}
void
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 2e815af91..4adbec2e5 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -812,11 +812,14 @@ typedef int32_t (*dumpop_inode_t) (xlator_t *this);
typedef int32_t (*dumpop_fd_t) (xlator_t *this);
+typedef int32_t (*dumpop_inodectx_t) (xlator_t *this, inode_t *ino);
+
struct xlator_dumpops {
dumpop_priv_t priv;
dumpop_inode_t inode;
dumpop_fd_t fd;
+ dumpop_inodectx_t inodectx;
};
typedef struct xlator_list {
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index 24782471e..46f3b8700 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -166,6 +166,34 @@ dht_priv_dump (xlator_t *this)
return 0;
}
+int32_t
+dht_inodectx_dump (xlator_t *this, inode_t *inode)
+{
+ int ret = -1;
+ char key_prefix[GF_DUMP_MAX_BUF_LEN];
+ dht_layout_t *layout = NULL;
+ uint64_t tmp_layout = 0;
+
+ if (!inode)
+ return -1;
+
+ ret = inode_ctx_get (inode, this, &tmp_layout);
+
+ if (ret != 0)
+ return ret;
+
+ layout = (dht_layout_t *)(long)tmp_layout;
+
+ if (!layout)
+ return -1;
+
+ gf_proc_dump_build_key(key_prefix, "xlator.cluster.dht",
+ "%s.inode.%ld", this->name, inode->ino);
+ dht_layout_dump(layout, key_prefix);
+
+ return 0;
+}
+
int
notify (xlator_t *this, int event, void *data, ...)
{
@@ -373,6 +401,7 @@ struct xlator_mops mops = {
struct xlator_dumpops dumpops = {
.priv = dht_priv_dump,
+ .inodectx = dht_inodectx_dump,
};
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 71098be5e..5514d4414 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -769,32 +769,34 @@ pl_forget (xlator_t *this,
}
-void
-pl_dump_inode_priv (inode_t *inode)
+int32_t
+pl_dump_inode_priv (xlator_t *this, inode_t *inode)
{
- int ret = -1;
- uint64_t tmp_pl_inode = 0;
- pl_inode_t *pl_inode = NULL;
- char key[GF_DUMP_MAX_BUF_LEN];
+ int ret = -1;
+ uint64_t tmp_pl_inode = 0;
+ pl_inode_t *pl_inode = NULL;
+ char key[GF_DUMP_MAX_BUF_LEN];
if (!inode)
- return;
+ return -1;
- ret = inode_ctx_get (inode, inode->table->xl, &tmp_pl_inode);
+ ret = inode_ctx_get (inode, this, &tmp_pl_inode);
if (ret != 0)
- return;
+ return ret;
pl_inode = (pl_inode_t *)(long)tmp_pl_inode;
if (!pl_inode)
- return;
+ return -1;
gf_proc_dump_build_key(key,
"xlator.feature.locks.inode",
- "%ld.%s",inode->ino, "mandatory");
+ "%ld.mandatory",inode->ino);
gf_proc_dump_write(key, "%d", pl_inode->mandatory);
+
+ return 0;
}
@@ -916,7 +918,7 @@ struct xlator_mops mops = {
};
struct xlator_dumpops dumpops = {
- .inode = pl_dump_inode,
+ .inodectx = pl_dump_inode_priv,
};
struct xlator_cbks cbks = {
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index bd6854caa..db4e507ae 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -6105,7 +6105,7 @@ client_priv_dump (xlator_t *this)
conf = this->private;
if (!conf) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_log (this->name, GF_LOG_WARNING,
"conf null in xlator");
return -1;
}
@@ -6141,6 +6141,31 @@ client_priv_dump (xlator_t *this)
}
+int32_t
+client_inodectx_dump (xlator_t *this, inode_t *inode)
+{
+ ino_t par = 0;
+ int ret = -1;
+ char key[GF_DUMP_MAX_BUF_LEN];
+
+ if (!inode)
+ return -1;
+
+ if (!this)
+ return -1;
+
+ ret = inode_ctx_get (inode, this, &par);
+
+ if (ret != 0)
+ return ret;
+
+ gf_proc_dump_build_key(key, "xlator.protocol.client",
+ "%s.inode.%ld.par",
+ this->name,inode->ino);
+ gf_proc_dump_write(key, "%ld", par);
+
+ return 0;
+}
/*
* client_protocol_notify - notify function for client protocol
@@ -6358,6 +6383,7 @@ struct xlator_cbks cbks = {
struct xlator_dumpops dumpops = {
.priv = client_priv_dump,
+ .inodectx = client_inodectx_dump,
};
struct volume_options options[] = {