diff -urN ext2-5/fs/ext2/ialloc.c ext2-6/fs/ext2/ialloc.c --- ext2-5/fs/ext2/ialloc.c Fri Dec 1 11:00:49 2000 +++ ext2-6/fs/ext2/ialloc.c Fri Dec 1 11:05:40 2000 @@ -39,37 +39,26 @@ * Read the inode allocation bitmap for a given block_group, reading * into the specified slot in the superblock's bitmap cache. * - * Return >=0 on success or a -ve error code. + * Return buffer_head of bitmap on success or NULL. */ -static int read_inode_bitmap (struct super_block * sb, - unsigned long block_group, - unsigned int bitmap_nr) +static struct buffer_head *read_inode_bitmap (struct super_block * sb, + unsigned long block_group) { struct ext2_group_desc * gdp; struct buffer_head * bh = NULL; - int retval = 0; gdp = ext2_get_group_desc (sb, block_group, NULL); - if (!gdp) { - retval = -EIO; + if (!gdp) goto error_out; - } + bh = bread (sb->s_dev, le32_to_cpu(gdp->bg_inode_bitmap), sb->s_blocksize); - if (!bh) { + if (!bh) ext2_error (sb, "read_inode_bitmap", "Cannot read inode bitmap - " "block_group = %lu, inode_bitmap = %lu", block_group, (unsigned long) gdp->bg_inode_bitmap); - retval = -EIO; - } - /* - * On IO error, just leave a zero in the superblock's block pointer for - * this group. The IO will be retried next time. - */ error_out: - sb->u.ext2_sb.s_inode_bitmap_number[bitmap_nr] = block_group; - sb->u.ext2_sb.s_inode_bitmap[bitmap_nr] = bh; - return retval; + return bh; } /* @@ -88,7 +77,7 @@ static int load_inode_bitmap (struct super_block * sb, unsigned int block_group) { - int i, retval = 0, slot = 0; + int i, slot = 0; struct ext2_sb_info *sbi = &sb->u.ext2_sb; struct buffer_head *bh = sbi->s_inode_bitmap[0]; @@ -151,9 +140,15 @@ } read_it: - retval = read_inode_bitmap (sb, block_group, slot); - if (retval < 0) - return retval; + bh = read_inode_bitmap (sb, block_group); + /* + * On IO error, just leave a zero in the superblock's block pointer for + * this group. The IO will be retried next time. + */ + sbi->s_inode_bitmap_number[slot] = block_group; + sbi->s_inode_bitmap[slot] = bh; + if (!bh) + return -EIO; found: return slot; }