aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glock.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-03-29 14:36:49 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-03-29 14:36:49 -0500
commitd0dc80dbafb5c10ad2084831a61bbf945484a139 (patch)
treef7434367a66e4e4be0885daefe5e59ab43502a7f /fs/gfs2/glock.c
parent484adff8a06cb5d952832f5487ae863f54c0fb69 (diff)
[GFS2] Update debugging code
Update the debugging code in trans.c and at the same time improve the debugging code for gfs2_holders. The new code should be pretty fast during the normal case and provide just as much information in case of errors (or more). One small function from glock.c has moved to glock.h as a static inline so that its return address won't get in the way of the debugging. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r--fs/gfs2/glock.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 81b06812b329..6a1b42cf4df4 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -16,6 +16,7 @@
16#include <linux/sort.h> 16#include <linux/sort.h>
17#include <linux/jhash.h> 17#include <linux/jhash.h>
18#include <linux/kref.h> 18#include <linux/kref.h>
19#include <linux/kallsyms.h>
19#include <linux/gfs2_ondisk.h> 20#include <linux/gfs2_ondisk.h>
20#include <asm/semaphore.h> 21#include <asm/semaphore.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
@@ -357,6 +358,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, int flags,
357{ 358{
358 INIT_LIST_HEAD(&gh->gh_list); 359 INIT_LIST_HEAD(&gh->gh_list);
359 gh->gh_gl = gl; 360 gh->gh_gl = gl;
361 gh->gh_ip = (unsigned long)__builtin_return_address(0);
360 gh->gh_owner = (flags & GL_NEVER_RECURSE) ? NULL : current; 362 gh->gh_owner = (flags & GL_NEVER_RECURSE) ? NULL : current;
361 gh->gh_state = state; 363 gh->gh_state = state;
362 gh->gh_flags = flags; 364 gh->gh_flags = flags;
@@ -388,6 +390,7 @@ void gfs2_holder_reinit(unsigned int state, int flags, struct gfs2_holder *gh)
388 gh->gh_flags |= GL_LOCAL_EXCL; 390 gh->gh_flags |= GL_LOCAL_EXCL;
389 391
390 gh->gh_iflags &= 1 << HIF_ALLOCED; 392 gh->gh_iflags &= 1 << HIF_ALLOCED;
393 gh->gh_ip = (unsigned long)__builtin_return_address(0);
391} 394}
392 395
393/** 396/**
@@ -400,6 +403,7 @@ void gfs2_holder_uninit(struct gfs2_holder *gh)
400{ 403{
401 gfs2_glock_put(gh->gh_gl); 404 gfs2_glock_put(gh->gh_gl);
402 gh->gh_gl = NULL; 405 gh->gh_gl = NULL;
406 gh->gh_ip = 0;
403} 407}
404 408
405/** 409/**
@@ -427,7 +431,7 @@ struct gfs2_holder *gfs2_holder_get(struct gfs2_glock *gl, unsigned int state,
427 431
428 gfs2_holder_init(gl, state, flags, gh); 432 gfs2_holder_init(gl, state, flags, gh);
429 set_bit(HIF_ALLOCED, &gh->gh_iflags); 433 set_bit(HIF_ALLOCED, &gh->gh_iflags);
430 434 gh->gh_ip = (unsigned long)__builtin_return_address(0);
431 return gh; 435 return gh;
432} 436}
433 437
@@ -1238,6 +1242,9 @@ static int recurse_check(struct gfs2_holder *existing, struct gfs2_holder *new,
1238 return 0; 1242 return 0;
1239 1243
1240 fail: 1244 fail:
1245 print_symbol(KERN_WARNING "GFS2: Existing holder from %s\n",
1246 existing->gh_ip);
1247 print_symbol(KERN_WARNING "GFS2: New holder from %s\n", new->gh_ip);
1241 set_bit(HIF_ABORTED, &new->gh_iflags); 1248 set_bit(HIF_ABORTED, &new->gh_iflags);
1242 return -EINVAL; 1249 return -EINVAL;
1243} 1250}
@@ -1544,30 +1551,6 @@ int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time)
1544} 1551}
1545 1552
1546/** 1553/**
1547 * gfs2_glock_nq_init - intialize a holder and enqueue it on a glock
1548 * @gl: the glock
1549 * @state: the state we're requesting
1550 * @flags: the modifier flags
1551 * @gh: the holder structure
1552 *
1553 * Returns: 0, GLR_*, or errno
1554 */
1555
1556int gfs2_glock_nq_init(struct gfs2_glock *gl, unsigned int state, int flags,
1557 struct gfs2_holder *gh)
1558{
1559 int error;
1560
1561 gfs2_holder_init(gl, state, flags, gh);
1562
1563 error = gfs2_glock_nq(gh);
1564 if (error)
1565 gfs2_holder_uninit(gh);
1566
1567 return error;
1568}
1569
1570/**
1571 * gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it 1554 * gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it
1572 * @gh: the holder structure 1555 * @gh: the holder structure
1573 * 1556 *
@@ -2334,6 +2317,7 @@ static int dump_holder(char *str, struct gfs2_holder *gh)
2334 if (test_bit(x, &gh->gh_iflags)) 2317 if (test_bit(x, &gh->gh_iflags))
2335 printk(" %u", x); 2318 printk(" %u", x);
2336 printk(" \n"); 2319 printk(" \n");
2320 print_symbol(KERN_INFO " initialized at: %s\n", gh->gh_ip);
2337 2321
2338 error = 0; 2322 error = 0;
2339 2323