summaryrefslogtreecommitdiff
path: root/fs/gfs2/glock.c
diff options
context:
space:
mode:
authorRobert Peterson <rpeterso@redhat.com>2007-04-18 20:41:11 +0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-05-01 12:11:33 +0400
commit5f8820960cf4fb621483d4a37c24939ad831bfe7 (patch)
tree8efc44452a7d353c41cefaf1b053a37868fb72c1 /fs/gfs2/glock.c
parentbdd19a22f85a7039e01accd8717eaec4addd9dfd (diff)
downloadlinux-5f8820960cf4fb621483d4a37c24939ad831bfe7.tar.xz
[GFS2] lockdump improvements
The patch below consists of the following changes (in code order): 1. I fixed a minor compiler warning regarding the printing of a kernel symbol address. 2. I implemented a suggestion from Dave Teigland that moves the debugfs information for gfs2 into a subdirectory so we can easily expand our use of debugfs in the future. The current code keeps the glock information in: /debug/gfs2/<fs> With the patch, the new code keeps the glock information in: /debug/gfs2/<fs>/glock That will allow us to create more debugfs files in the future. 3. This fixes a bug whereby a failed mount attempt causes the debugfs file to not be deleted. Failed mount attempts should always clean up after themselves, including deleting the debugfs file and/or directory. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r--fs/gfs2/glock.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index b075f9359c60..7988715b7a07 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1774,7 +1774,7 @@ static void gfs2_print_symbol(struct glock_iter *gi, const char *fmt,
if (gi) {
memset(buffer, 0, sizeof(buffer));
- sprintf(buffer, "%p", address);
+ sprintf(buffer, "0x%08lx", address);
print_dbg(gi, fmt, buffer);
}
else
@@ -2146,11 +2146,14 @@ static const struct file_operations gfs2_debug_fops = {
int gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
{
- sdp->debugfs_dentry = debugfs_create_file(sdp->sd_table_name,
- S_IFREG | S_IRUGO,
- gfs2_root, sdp,
- &gfs2_debug_fops);
- if (!sdp->debugfs_dentry)
+ sdp->debugfs_dir = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
+ if (!sdp->debugfs_dir)
+ return -ENOMEM;
+ sdp->debugfs_dentry_glocks = debugfs_create_file("glocks",
+ S_IFREG | S_IRUGO,
+ sdp->debugfs_dir, sdp,
+ &gfs2_debug_fops);
+ if (!sdp->debugfs_dentry_glocks)
return -ENOMEM;
return 0;
@@ -2158,8 +2161,14 @@ int gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp)
{
- if (sdp && sdp->debugfs_dentry)
- debugfs_remove(sdp->debugfs_dentry);
+ if (sdp && sdp->debugfs_dir) {
+ if (sdp->debugfs_dentry_glocks) {
+ debugfs_remove(sdp->debugfs_dentry_glocks);
+ sdp->debugfs_dentry_glocks = NULL;
+ }
+ debugfs_remove(sdp->debugfs_dir);
+ sdp->debugfs_dir = NULL;
+ }
}
int gfs2_register_debugfs(void)
@@ -2171,4 +2180,5 @@ int gfs2_register_debugfs(void)
void gfs2_unregister_debugfs(void)
{
debugfs_remove(gfs2_root);
+ gfs2_root = NULL;
}