summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2009-09-15 04:46:44 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-16 07:11:33 -0700
commitdcfc4bdd5962ad18665d9ad3f3309884c941845e (patch)
tree85fa786eab575ed48fbd50db9f0613cf9150dde3
parent5480b6eca96a8da4b159783a19f2ed5c2f640769 (diff)
Changed prototype for inode_table_dump() and inode_dump().
Changed prototype for inode_table_dump() and inode_dump() Added support for dumpop inode in mount/fuse and protocol/server 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.c34
-rw-r--r--libglusterfs/src/statedump.h6
-rw-r--r--xlators/features/locks/src/posix.c3
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c13
-rw-r--r--xlators/protocol/server/src/server-protocol.c40
5 files changed, 76 insertions, 20 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 138e30068..06f742cc6 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -36,7 +36,7 @@
move latest accessed dentry to list_head of inode
*/
-#define INODE_DUMP_LIST(head, key_buf, key_prefix, list_type, fn) \
+#define INODE_DUMP_LIST(head, key_buf, key_prefix, list_type) \
{ \
int i = 1;\
inode_t *inode = NULL;\
@@ -44,7 +44,7 @@
gf_proc_dump_build_key(key_buf, key_prefix, "%s.%d",list_type,\
i++);\
gf_proc_dump_add_section(key_buf);\
- inode_dump(inode, key, fn);\
+ inode_dump(inode, key);\
}\
}
@@ -1209,10 +1209,10 @@ unlock:
}
void
-inode_dump (inode_t *inode, char *prefix, inode_priv_dump_fn fn)
+inode_dump (inode_t *inode, char *prefix)
{
- char key[GF_DUMP_MAX_BUF_LEN];
- int ret;
+ char key[GF_DUMP_MAX_BUF_LEN];
+ int ret = -1;
if (!inode)
return;
@@ -1236,20 +1236,27 @@ inode_dump (inode_t *inode, char *prefix, inode_priv_dump_fn fn)
gf_proc_dump_build_key(key, prefix, "st_mode");
gf_proc_dump_write(key, "%d", inode->st_mode);
UNLOCK(&inode->lock);
- if (fn)
- fn (inode);
}
void
-inode_table_dump (inode_table_t *itable, char *prefix, inode_priv_dump_fn fn)
+inode_table_dump (inode_table_t *itable, char *prefix)
{
- char key[GF_DUMP_MAX_BUF_LEN];
+ char key[GF_DUMP_MAX_BUF_LEN];
+ int ret = 0;
if (!itable)
return;
memset(key, 0, sizeof(key));
+ ret = pthread_mutex_trylock(&itable->lock);
+
+ if (ret != 0) {
+ gf_log("", GF_LOG_WARNING, "Unable to dump inode table"
+ " errno: %d", errno);
+ return;
+ }
+
gf_proc_dump_build_key(key, prefix, "hashsize");
gf_proc_dump_write(key, "%d", itable->hashsize);
gf_proc_dump_build_key(key, prefix, "name");
@@ -1264,9 +1271,10 @@ inode_table_dump (inode_table_t *itable, char *prefix, inode_priv_dump_fn fn)
gf_proc_dump_build_key(key, prefix, "purge_size");
gf_proc_dump_write(key, "%d", itable->purge_size);
- pthread_mutex_lock(&itable->lock);
- INODE_DUMP_LIST(&itable->active, key, prefix, "active", fn);
- INODE_DUMP_LIST(&itable->lru, key, prefix, "lru", fn);
- INODE_DUMP_LIST(&itable->purge, key, prefix, "purge", fn);
+ INODE_DUMP_LIST(&itable->active, key, prefix, "active");
+ INODE_DUMP_LIST(&itable->lru, key, prefix, "lru");
+ INODE_DUMP_LIST(&itable->purge, key, prefix, "purge");
+
+ pthread_mutex_unlock(&itable->lock);
}
diff --git a/libglusterfs/src/statedump.h b/libglusterfs/src/statedump.h
index 9ac50ec0c..1997c65b9 100644
--- a/libglusterfs/src/statedump.h
+++ b/libglusterfs/src/statedump.h
@@ -47,8 +47,6 @@ void _gf_proc_dump_build_key (char *key, const char *prefix, char *fmt,...)
_gf_proc_dump_build_key(key, key_prefix, ##fmt);\
}
-typedef void (*inode_priv_dump_fn) (inode_t *);
-
void
gf_proc_dump_init();
@@ -68,11 +66,11 @@ void
gf_proc_dump_write(char *key, char *value,...);
void
-inode_table_dump(inode_table_t *itable, char *prefix, inode_priv_dump_fn fn);
+inode_table_dump(inode_table_t *itable, char *prefix);
void
fdtable_dump(fdtable_t *fdtable, char *prefix);
void
-inode_dump(inode_t *inode, char *prefix, inode_priv_dump_fn fn);
+inode_dump(inode_t *inode, char *prefix);
#endif /* STATEDUMP_H */
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 7389e1e6a..71098be5e 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -811,8 +811,7 @@ pl_dump_inode (xlator_t *this)
if (this->itable) {
inode_table_dump(this->itable,
- "xlator.features.locks.inode_table",
- pl_dump_inode_priv);
+ "xlator.features.locks.inode_table");
}
return 0;
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 85b7d15f6..dcb4e2950 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -2928,6 +2928,18 @@ fuse_thread_proc (void *data)
}
int32_t
+fuse_itable_dump (xlator_t *this)
+{
+ if (!this)
+ return -1;
+
+ gf_proc_dump_add_section("xlator.mount.fuse.itable");
+ inode_table_dump(this->itable, "xlator.mount.fuse.itable");
+
+ return 0;
+}
+
+int32_t
fuse_priv_dump (xlator_t *this)
{
fuse_private_t *private = NULL;
@@ -3244,6 +3256,7 @@ struct xlator_mops mops = {
struct xlator_dumpops dumpops = {
.priv = fuse_priv_dump,
+ .inode = fuse_itable_dump,
};
struct volume_options options[] = {
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index 9306a9232..e7660d245 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -7590,8 +7590,46 @@ server_priv (xlator_t *this)
int
server_inode (xlator_t *this)
{
- return 0;
+ server_conf_t *conf = NULL;
+ server_connection_t *trav = NULL;
+ char key[GF_DUMP_MAX_BUF_LEN];
+ int i = 1;
+ int ret = -1;
+
+ if (!this)
+ return -1;
+
+ conf = this->private;
+ if (!conf) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "conf null in xlator");
+ return -1;
+ }
+
+ ret = pthread_mutex_trylock (&conf->mutex);
+ if (ret) {
+ gf_log("", GF_LOG_WARNING, "Unable to dump itable"
+ " errno: %d", errno);
+ return -1;
+ }
+
+ list_for_each_entry (trav, &conf->conns, list) {
+ if (trav->bound_xl && trav->bound_xl->itable) {
+ gf_proc_dump_build_key(key,
+ "xlator.protocol.server.conn",
+ "%d.bound_xl.%s",
+ i, trav->bound_xl->name);
+ inode_table_dump(trav->bound_xl->itable,key);
+ i++;
+ }
+ }
+ pthread_mutex_unlock (&conf->mutex);
+
+
+ return 0;
}
+
+
static void
get_auth_types (dict_t *this, char *key, data_t *value, void *data)
{