diff options
author | Bob Peterson <rpeterso@redhat.com> | 2011-03-22 10:49:12 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-04-20 03:53:12 -0400 |
commit | 95c8e17f2f00f6af7474fac0e4050a79db6c3cea (patch) | |
tree | 5e4ee14869e6e01625620e56c43c8baeaf7b552c | |
parent | 2f666bcf757cb72549f360ef6da02f03620a48b6 (diff) |
GFS2: Dump better debug info if a bitmap inconsistency is detected
On rare occasions we encounter gfs2 problems where an
invalid bitmap state transition is attempted. For example,
trying to "unlink" a free block. In these cases, there
is really no useful information logged to debug the problem.
This patch adds more debug details that should allow us to
more closely examine the problem and possibly solve it.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/rgrp.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 6fcae8469f6d..b643c14caff9 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -78,10 +78,11 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, | |||
78 | 78 | ||
79 | static inline void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buf1, | 79 | static inline void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buf1, |
80 | unsigned char *buf2, unsigned int offset, | 80 | unsigned char *buf2, unsigned int offset, |
81 | unsigned int buflen, u32 block, | 81 | struct gfs2_bitmap *bi, u32 block, |
82 | unsigned char new_state) | 82 | unsigned char new_state) |
83 | { | 83 | { |
84 | unsigned char *byte1, *byte2, *end, cur_state; | 84 | unsigned char *byte1, *byte2, *end, cur_state; |
85 | unsigned int buflen = bi->bi_len; | ||
85 | const unsigned int bit = (block % GFS2_NBBY) * GFS2_BIT_SIZE; | 86 | const unsigned int bit = (block % GFS2_NBBY) * GFS2_BIT_SIZE; |
86 | 87 | ||
87 | byte1 = buf1 + offset + (block / GFS2_NBBY); | 88 | byte1 = buf1 + offset + (block / GFS2_NBBY); |
@@ -92,6 +93,16 @@ static inline void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buf1, | |||
92 | cur_state = (*byte1 >> bit) & GFS2_BIT_MASK; | 93 | cur_state = (*byte1 >> bit) & GFS2_BIT_MASK; |
93 | 94 | ||
94 | if (unlikely(!valid_change[new_state * 4 + cur_state])) { | 95 | if (unlikely(!valid_change[new_state * 4 + cur_state])) { |
96 | printk(KERN_WARNING "GFS2: buf_blk = 0x%llx old_state=%d, " | ||
97 | "new_state=%d\n", | ||
98 | (unsigned long long)block, cur_state, new_state); | ||
99 | printk(KERN_WARNING "GFS2: rgrp=0x%llx bi_start=0x%lx\n", | ||
100 | (unsigned long long)rgd->rd_addr, | ||
101 | (unsigned long)bi->bi_start); | ||
102 | printk(KERN_WARNING "GFS2: bi_offset=0x%lx bi_len=0x%lx\n", | ||
103 | (unsigned long)bi->bi_offset, | ||
104 | (unsigned long)bi->bi_len); | ||
105 | dump_stack(); | ||
95 | gfs2_consist_rgrpd(rgd); | 106 | gfs2_consist_rgrpd(rgd); |
96 | return; | 107 | return; |
97 | } | 108 | } |
@@ -1365,7 +1376,7 @@ skip: | |||
1365 | 1376 | ||
1366 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); | 1377 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); |
1367 | gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset, | 1378 | gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset, |
1368 | bi->bi_len, blk, new_state); | 1379 | bi, blk, new_state); |
1369 | goal = blk; | 1380 | goal = blk; |
1370 | while (*n < elen) { | 1381 | while (*n < elen) { |
1371 | goal++; | 1382 | goal++; |
@@ -1375,7 +1386,7 @@ skip: | |||
1375 | GFS2_BLKST_FREE) | 1386 | GFS2_BLKST_FREE) |
1376 | break; | 1387 | break; |
1377 | gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset, | 1388 | gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset, |
1378 | bi->bi_len, goal, new_state); | 1389 | bi, goal, new_state); |
1379 | (*n)++; | 1390 | (*n)++; |
1380 | } | 1391 | } |
1381 | out: | 1392 | out: |
@@ -1432,7 +1443,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | |||
1432 | } | 1443 | } |
1433 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); | 1444 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); |
1434 | gfs2_setbit(rgd, bi->bi_bh->b_data, NULL, bi->bi_offset, | 1445 | gfs2_setbit(rgd, bi->bi_bh->b_data, NULL, bi->bi_offset, |
1435 | bi->bi_len, buf_blk, new_state); | 1446 | bi, buf_blk, new_state); |
1436 | } | 1447 | } |
1437 | 1448 | ||
1438 | return rgd; | 1449 | return rgd; |