Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 321fb9e8 authored by Mingming Cao's avatar Mingming Cao Committed by Linus Torvalds
Browse files

[PATCH] ext3: turn on reservation dump on block allocation errors



In the past there were a few kernel panics 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: default avatarMingming Cao <cmm@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 37ed3222
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
 * we could easily switch to that without changing too much
 * we could easily switch to that without changing too much
 * code.
 * code.
 */
 */
#if 0
#if 1
static void __rsv_window_dump(struct rb_root *root, int verbose,
static void __rsv_window_dump(struct rb_root *root, int verbose,
			      const char *fn)
			      const char *fn)
{
{
@@ -129,7 +129,7 @@ static void __rsv_window_dump(struct rb_root *root, int verbose,
		rsv = list_entry(n, struct ext3_reserve_window_node, rsv_node);
		rsv = list_entry(n, struct ext3_reserve_window_node, rsv_node);
		if (verbose)
		if (verbose)
			printk("reservation window 0x%p "
			printk("reservation window 0x%p "
			       "start:  %d, end:  %d\n",
			       "start:  %lu, end:  %lu\n",
			       rsv, rsv->rsv_start, rsv->rsv_end);
			       rsv, rsv->rsv_start, rsv->rsv_end);
		if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) {
		if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) {
			printk("Bad reservation %p (start >= end)\n",
			printk("Bad reservation %p (start >= end)\n",
@@ -236,9 +236,11 @@ void ext3_rsv_window_add(struct super_block *sb,
			p = &(*p)->rb_left;
			p = &(*p)->rb_left;
		else if (start > this->rsv_end)
		else if (start > this->rsv_end)
			p = &(*p)->rb_right;
			p = &(*p)->rb_right;
		else
		else {
			rsv_window_dump(root, 1);
			BUG();
			BUG();
		}
		}
	}


	rb_link_node(node, parent, p);
	rb_link_node(node, parent, p);
	rb_insert_color(node, root);
	rb_insert_color(node, root);
@@ -1133,8 +1135,10 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle,
					*count-my_rsv->rsv_end + grp_goal - 1);
					*count-my_rsv->rsv_end + grp_goal - 1);


		if ((my_rsv->rsv_start >= group_first_block + EXT3_BLOCKS_PER_GROUP(sb))
		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();
			BUG();
		}
		ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, grp_goal,
		ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, grp_goal,
					   &num, &my_rsv->rsv_window);
					   &num, &my_rsv->rsv_window);
		if (ret >= 0) {
		if (ret >= 0) {