From: Andrew Morton Date: Tue, 18 Nov 2003 16:15:53 +0000 (-0800) Subject: [PATCH] ext3_new_inode fixlet X-Git-Tag: v2.6.0-test10~17 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=bc5de0cdb593cf9f8b8df9a8de6f81a0822c7ed5;p=history.git [PATCH] ext3_new_inode fixlet From: Alex Tomas 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. --- diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 7f0c2bfb81f7..13f61fc9e85a 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c @@ -469,8 +469,11 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) 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 *handle, struct inode * dir, int mode) } /* we lost it */ journal_release_buffer(handle, bitmap_bh, credits); + + if (++ino < EXT3_INODES_PER_GROUP(sb)) + goto repeat_in_this_group; } /*