FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 04-16-2008, 02:58 PM
Bob Peterson
 
Default Make dump_glock a bit more friendly

Hi,

This patch makes the glock dump a little more user-friendly.
My primary goal was to get rid of the very-misleading report
of the glock being "(unlocked)" based on gl_flag, but it goes
a step further. If it's too verbose, feel free to say no.

Regards,

Bob Peterson
--
fs/gfs2/glock.c | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index d636b3e..53396e7 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -122,6 +122,20 @@ static inline rwlock_t *gl_lock_addr(unsigned int x)
}
#endif

+const char *gl_flags[] = {"",
+ "GLF_LOCK",
+ "GLF_STICKY",
+ "GLF_DEMOTE",
+ "GLF_PENDING_DEMOTE",
+ "GLF_DIRTY"
+};
+
+const char *gl_states[] = {"LM_ST_UNLOCKED",
+ "LM_ST_EXCLUSIVE",
+ "LM_ST_DEFERRED",
+ "LM_ST_SHARED"
+};
+
/**
* relaxed_state_ok - is a requested lock compatible with the current lock mode?
* @actual: the current state of the lock
@@ -1903,6 +1917,7 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl)
unsigned int x;
int error = -ENOBUFS;
struct task_struct *gl_owner;
+ int first, count;

spin_lock(&gl->gl_spin);

@@ -1913,11 +1928,22 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl)
if (test_bit(x, &gl->gl_flags))
print_dbg(gi, " %u", x);
}
- if (!test_bit(GLF_LOCK, &gl->gl_flags))
- print_dbg(gi, " (unlocked)");
+ first = 1;
+ count = 0;
+ for (x = GLF_LOCK; x <= GLF_DIRTY; x++) {
+ if (test_bit(x, &gl->gl_flags)) {
+ print_dbg(gi, "%c", first ? '(' : '|');
+ print_dbg(gi, "%s", gl_flags[x]);
+ first = 0;
+ count++;
+ }
+ }
+ if (count)
+ print_dbg(gi, ")");
print_dbg(gi, "
");
print_dbg(gi, " gl_ref = %d
", atomic_read(&gl->gl_ref));
- print_dbg(gi, " gl_state = %u
", gl->gl_state);
+ print_dbg(gi, " gl_state = %u (%s)
", gl->gl_state,
+ gl_states[gl->gl_state & 0x3]);
if (gl->gl_owner_pid) {
gl_owner = pid_task(gl->gl_owner_pid, PIDTYPE_PID);
if (gl_owner)
@@ -1932,6 +1958,8 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl)
print_dbg(gi, " req_gh = %s
", (gl->gl_req_gh) ? "yes" : "no");
print_dbg(gi, " lvb_count = %d
", atomic_read(&gl->gl_lvb_count));
print_dbg(gi, " object = %s
", (gl->gl_object) ? "yes" : "no");
+ print_dbg(gi, " le = %s
",
+ (list_empty(&gl->gl_le.le_list)) ? "no" : "yes");
print_dbg(gi, " reclaim = %s
",
(list_empty(&gl->gl_reclaim)) ? "no" : "yes");
if (gl->gl_aspace)
 

Thread Tools




All times are GMT. The time now is 10:47 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org