[PATCH 2/3] Turn on reservation dump on block allocation errors

Mingming Cao <[email protected]> Tue, 22 Aug 2006 17:52:23 -0700
Newsgroups gmane.comp.file-systems.ext2.devel
Organization IBM LTC
Message-ID <[email protected]>
In the past there are a few kernel panic related to block reservation
tree operations failure (insert/remove etc). It would be very useful to
get the block allocation reservation map info when such error happens.


Signed-Off-By: Mingming Cao <[email protected]>

---

 linux-2.6.18-rc4-ming/fs/ext3/balloc.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff -puN fs/ext3/balloc.c~ext3-turn-on-resservation-dump-on-failure fs/ext3/balloc.c
--- linux-2.6.18-rc4/fs/ext3/balloc.c~ext3-turn-on-resservation-dump-on-failure	2006-08-11 17:41:04.674577537 -0700
+++ linux-2.6.18-rc4-ming/fs/ext3/balloc.c	2006-08-11 17:41:04.679576963 -0700
@@ -111,7 +111,7 @@ error_out:
  * we could easily switch to that without changing too much
  * code.
  */
-#if 0
+#if 1
 static void __rsv_window_dump(struct rb_root *root, int verbose,
 			      const char *fn)
 {
@@ -129,7 +129,7 @@ restart:
 		rsv = list_entry(n, struct ext3_reserve_window_node, rsv_node);
 		if (verbose)
 			printk("reservation window 0x%p "
-			       "start:  %d, end:  %d\n",
+			       "start:  %lu, end:  %lu\n",
 			       rsv, rsv->rsv_start, rsv->rsv_end);
 		if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) {
 			printk("Bad reservation %p (start >= end)\n",
@@ -236,8 +236,10 @@ void ext3_rsv_window_add(struct super_bl
 			p = &(*p)->rb_left;
 		else if (start > this->rsv_end)
 			p = &(*p)->rb_right;
-		else
+		else {
+			rsv_window_dump(root, 1);
 			BUG();
+		}
 	}
 
 	rb_link_node(node, parent, p);
@@ -1133,8 +1135,10 @@ ext3_try_to_allocate_with_rsv(struct sup
 					*count-my_rsv->rsv_end + grp_goal - 1);
 
 		if ((my_rsv->rsv_start >= group_first_block + EXT3_BLOCKS_PER_GROUP(sb))
-		    || (my_rsv->rsv_end < group_first_block))
+		    || (my_rsv->rsv_end < group_first_block)) {
+			rsv_window_dump(&EXT3_SB(sb)->s_rsv_window_root, 1);
 			BUG();
+		}
 		ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, grp_goal,
 					   &num, &my_rsv->rsv_window);
 		if (ret >= 0) {

_



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642