From 9ef8eabae21a3073f3dc09602d0680d631cbd576 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 29 Sep 2011 12:11:44 +0530 Subject: statedump: do not print the inode number in the statedump Since gfid is used to uniquely identify a inode, in the statedump printing inode number is not necessary. Its suffecient if the gfid of the inode is printed. And do not print the the inodelks, entrylks and posixlks if the lock count is 0. Change-Id: Idac115fbce3a5684a0f02f8f5f20b194df8fb27f BUG: 3476 Reviewed-on: http://review.gluster.com/530 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- libglusterfs/src/fd.c | 13 ++------ libglusterfs/src/inode.c | 15 +++------ libglusterfs/src/stack.c | 72 +++++++++++++++++--------------------------- libglusterfs/src/statedump.c | 27 +++++++---------- 4 files changed, 45 insertions(+), 82 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 7779dfe2..bd12519b 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -726,16 +726,9 @@ fd_dump (fd_t *fd, char *prefix) return; memset(key, 0, sizeof(key)); - gf_proc_dump_build_key(key, prefix, "pid"); - gf_proc_dump_write(key, "%d", fd->pid); - gf_proc_dump_build_key(key, prefix, "refcount"); - gf_proc_dump_write(key, "%d", fd->refcount); - gf_proc_dump_build_key(key, prefix, "flags"); - gf_proc_dump_write(key, "%d", fd->flags); - if (fd->inode) { - gf_proc_dump_build_key(key, prefix, "inode"); - gf_proc_dump_write(key, "%ld", fd->inode->ino); - } + gf_proc_dump_write("pid", "%d", fd->pid); + gf_proc_dump_write("refcount", "%d", fd->refcount); + gf_proc_dump_write("flags", "%d", fd->flags); } diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 7f938236..117b977b 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -1495,7 +1495,6 @@ inode_ctx_del (inode_t *inode, xlator_t *key, uint64_t *value) void inode_dump (inode_t *inode, char *prefix) { - char key[GF_DUMP_MAX_BUF_LEN]; int ret = -1; xlator_t *xl = NULL; int i = 0; @@ -1518,16 +1517,10 @@ inode_dump (inode_t *inode, char *prefix) } { - gf_proc_dump_build_key(key, prefix, "gfid"); - gf_proc_dump_write(key, "%s", uuid_utoa (inode->gfid)); - gf_proc_dump_build_key(key, prefix, "nlookup"); - gf_proc_dump_write(key, "%ld", inode->nlookup); - gf_proc_dump_build_key(key, prefix, "ref"); - gf_proc_dump_write(key, "%u", inode->ref); - gf_proc_dump_build_key(key, prefix, "ino"); - gf_proc_dump_write(key, "%ld", inode->ino); - gf_proc_dump_build_key(key, prefix, "ia_type"); - gf_proc_dump_write(key, "%d", inode->ia_type); + gf_proc_dump_write("gfid", "%s", uuid_utoa (inode->gfid)); + gf_proc_dump_write("nlookup", "%ld", inode->nlookup); + gf_proc_dump_write("ref", "%u", inode->ref); + gf_proc_dump_write("ia_type", "%d", inode->ia_type); if (inode->_ctx) { inode_ctx = GF_CALLOC (inode->table->xl->graph->xl_count, sizeof (*inode_ctx), diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c index f4110528..0f65faa6 100644 --- a/libglusterfs/src/stack.c +++ b/libglusterfs/src/stack.c @@ -41,7 +41,6 @@ gf_proc_dump_call_frame (call_frame_t *call_frame, const char *key_buf,...) char prefix[GF_DUMP_MAX_BUF_LEN]; va_list ap; - char key[GF_DUMP_MAX_BUF_LEN]; call_frame_t my_frame; int ret = -1; @@ -66,32 +65,23 @@ gf_proc_dump_call_frame (call_frame_t *call_frame, const char *key_buf,...) memcpy(&my_frame, call_frame, sizeof(my_frame)); UNLOCK(&call_frame->lock); - gf_proc_dump_build_key(key, prefix,"ref_count"); - gf_proc_dump_write(key, "%d", my_frame.ref_count); - gf_proc_dump_build_key(key, prefix,"translator"); - gf_proc_dump_write(key, "%s", my_frame.this->name); - gf_proc_dump_build_key(key, prefix,"complete"); - gf_proc_dump_write(key, "%d", my_frame.complete); - if (my_frame.parent) { - gf_proc_dump_build_key(key, prefix,"parent"); - gf_proc_dump_write(key, "%s", my_frame.parent->this->name); - } - if (my_frame.wind_from) { - gf_proc_dump_build_key(key, prefix, "wind_from"); - gf_proc_dump_write(key, "%s", my_frame.wind_from); - } - if (my_frame.wind_to) { - gf_proc_dump_build_key(key, prefix, "wind_to"); - gf_proc_dump_write(key, "%s", my_frame.wind_to); - } - if (my_frame.unwind_from) { - gf_proc_dump_build_key(key, prefix, "unwind_from"); - gf_proc_dump_write(key, "%s", my_frame.unwind_from); - } - if (my_frame.unwind_to) { - gf_proc_dump_build_key(key, prefix, "unwind_to"); - gf_proc_dump_write(key, "%s", my_frame.unwind_to); - } + gf_proc_dump_write("ref_count", "%d", my_frame.ref_count); + gf_proc_dump_write("translator", "%s", my_frame.this->name); + gf_proc_dump_write("complete", "%d", my_frame.complete); + if (my_frame.parent) + gf_proc_dump_write("parent", "%s", my_frame.parent->this->name); + + if (my_frame.wind_from) + gf_proc_dump_write("wind_from", "%s", my_frame.wind_from); + + if (my_frame.wind_to) + gf_proc_dump_write("wind_to", "%s", my_frame.wind_to); + + if (my_frame.unwind_from) + gf_proc_dump_write("unwind_from", "%s", my_frame.unwind_from); + + if (my_frame.unwind_to) + gf_proc_dump_write("unwind_to", "%s", my_frame.unwind_to); } @@ -102,7 +92,6 @@ gf_proc_dump_call_stack (call_stack_t *call_stack, const char *key_buf,...) va_list ap; call_frame_t *trav; int32_t cnt, i; - char key[GF_DUMP_MAX_BUF_LEN]; if (!call_stack) return; @@ -116,25 +105,18 @@ gf_proc_dump_call_stack (call_stack_t *call_stack, const char *key_buf,...) vsnprintf(prefix, GF_DUMP_MAX_BUF_LEN, key_buf, ap); va_end(ap); - gf_proc_dump_build_key(key, prefix,"uid"); - gf_proc_dump_write(key, "%d", call_stack->uid); - gf_proc_dump_build_key(key, prefix,"gid"); - gf_proc_dump_write(key, "%d", call_stack->gid); - gf_proc_dump_build_key(key, prefix,"pid"); - gf_proc_dump_write(key, "%d", call_stack->pid); - gf_proc_dump_build_key(key, prefix,"unique"); - gf_proc_dump_write(key, "%Ld", call_stack->unique); + gf_proc_dump_write("uid", "%d", call_stack->uid); + gf_proc_dump_write("gid", "%d", call_stack->gid); + gf_proc_dump_write("pid", "%d", call_stack->pid); + gf_proc_dump_write("unique", "%Ld", call_stack->unique); - gf_proc_dump_build_key(key, prefix,"op"); if (call_stack->type == GF_OP_TYPE_FOP) - gf_proc_dump_write(key, "%s", gf_fop_list[call_stack->op]); + gf_proc_dump_write("op", "%s", gf_fop_list[call_stack->op]); else if (call_stack->type == GF_OP_TYPE_MGMT) - gf_proc_dump_write(key, "%s", gf_mgmt_list[call_stack->op]); + gf_proc_dump_write("op", "%s", gf_mgmt_list[call_stack->op]); - gf_proc_dump_build_key(key, prefix,"type"); - gf_proc_dump_write(key, "%d", call_stack->type); - gf_proc_dump_build_key(key, prefix,"cnt"); - gf_proc_dump_write(key, "%d", cnt); + gf_proc_dump_write("type", "%d", call_stack->type); + gf_proc_dump_write("cnt", "%d", cnt); trav = &call_stack->frames; @@ -167,8 +149,8 @@ gf_proc_dump_pending_frames (call_pool_t *call_pool) gf_proc_dump_add_section("global.callpool"); - gf_proc_dump_write("global.callpool","%p", call_pool); - gf_proc_dump_write("global.callpool.cnt","%d", call_pool->cnt); + gf_proc_dump_write("callpool_address","%p", call_pool); + gf_proc_dump_write("callpool.cnt","%d", call_pool->cnt); list_for_each_entry (trav, &call_pool->all_frames, all_frames) { diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index 525980bf..52de73b5 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -139,8 +139,6 @@ gf_proc_dump_write (char *key, char *value,...) static void gf_proc_dump_xlator_mem_info (xlator_t *xl) { - char key[GF_DUMP_MAX_BUF_LEN]; - char prefix[GF_DUMP_MAX_BUF_LEN]; int i = 0; struct mem_acct rec = {0,}; @@ -158,20 +156,17 @@ gf_proc_dump_xlator_mem_info (xlator_t *xl) sizeof (struct mem_acct)))) continue; - gf_proc_dump_add_section ("%s.%s - usage-type %d", xl->type, - xl->name,i); - gf_proc_dump_build_key (prefix, "memusage", "%s.%s.type.%d", - xl->type, xl->name, i); - gf_proc_dump_build_key (key, prefix, "size"); - gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].size); - gf_proc_dump_build_key (key, prefix, "num_allocs"); - gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].num_allocs); - gf_proc_dump_build_key (key, prefix, "max_size"); - gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].max_size); - gf_proc_dump_build_key (key, prefix, "max_num_allocs"); - gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].max_num_allocs); - gf_proc_dump_build_key (key, prefix, "total_allocs"); - gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].total_allocs); + gf_proc_dump_add_section ("%s.%s - usage-type %d memusage", + xl->type, xl->name, i); + gf_proc_dump_write ("size", "%u", xl->mem_acct.rec[i].size); + gf_proc_dump_write ("num_allocs", "%u", + xl->mem_acct.rec[i].num_allocs); + gf_proc_dump_write ("max_size", "%u", + xl->mem_acct.rec[i].max_size); + gf_proc_dump_write ("max_num_allocs", "%u", + xl->mem_acct.rec[i].max_num_allocs); + gf_proc_dump_write ("total_allocs", "%u", + xl->mem_acct.rec[i].total_allocs); } return; -- cgit