From: Alex Tomas <alex@clusterfs.com>

If the ext3 inode allocator tries to claim an inode and fails because
another CPU got in there first it will then advance onto the next
blockgroup and try again.

Change it to advance onto the next inode within the same blockgroup
instead.


 fs/ext3/ialloc.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -puN fs/ext3/ialloc.c~ext3_new_inode-scan-fix fs/ext3/ialloc.c
--- 25/fs/ext3/ialloc.c~ext3_new_inode-scan-fix	2003-11-09 11:19:08.000000000 -0800
+++ 25-akpm/fs/ext3/ialloc.c	2003-11-09 11:19:08.000000000 -0800
@@ -469,8 +469,11 @@ struct inode *ext3_new_inode(handle_t *h
 		if (!bitmap_bh)
 			goto fail;
 
-		ino = ext3_find_first_zero_bit((unsigned long *)
-				bitmap_bh->b_data, EXT3_INODES_PER_GROUP(sb));
+		ino = 0;
+
+repeat_in_this_group:
+		ino = ext3_find_next_zero_bit((unsigned long *)
+				bitmap_bh->b_data, EXT3_INODES_PER_GROUP(sb), ino);
 		if (ino < EXT3_INODES_PER_GROUP(sb)) {
 			int credits = 0;
 
@@ -493,6 +496,9 @@ struct inode *ext3_new_inode(handle_t *h
 			}
 			/* we lost it */
 			journal_release_buffer(handle, bitmap_bh, credits);
+
+			if (++ino < EXT3_INODES_PER_GROUP(sb))
+				goto repeat_in_this_group;
 		}
 
 		/*

_