kernels/linux-2.4.0/fs/ext2/ialloc.c
/* Called at mount-time, super-block is locked */
Called at mount-time, super-block is locked
Called at mount - time super - block is locked
void ext2_check_inodes_bitmap (struct super_block * sb)
{
	struct ext2_super_block * es;
	unsigned long desc_count, bitmap_count, x;
	int bitmap_nr;
	struct ext2_group_desc * gdp;
	int i;
	es = sb->u.ext2_sb.s_es;
	desc_count = 0;
	bitmap_count = 0;
	gdp = NULL;
	for (i = 0; i < sb->u.ext2_sb.s_groups_count; i++) {
		gdp = ext2_get_group_desc (sb, i, NULL);
		if (!gdp)
			continue;
		desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
		bitmap_nr = load_inode_bitmap (sb, i);
		if (bitmap_nr < 0)
			continue;
		x = ext2_count_free (sb->u.ext2_sb.s_inode_bitmap[bitmap_nr],
				     EXT2_INODES_PER_GROUP(sb) / 8);
		if (le16_to_cpu(gdp->bg_free_inodes_count) != x)
			ext2_error (sb, "ext2_check_inodes_bitmap",
				    "Wrong free inodes count in group %d, "
				    "stored = %d, counted = %lu", i,
				    le16_to_cpu(gdp->bg_free_inodes_count), x);
		bitmap_count += x;
	}
	if (le32_to_cpu(es->s_free_inodes_count) != bitmap_count)
		ext2_error (sb, "ext2_check_inodes_bitmap",
			    "Wrong free inodes count in super block, "
			    "stored = %lu, counted = %lu",
			    (unsigned long) le32_to_cpu(es->s_free_inodes_count),
			    bitmap_count);
}
void ext2_check_inodes_bitmap ( struct super_block * sb ) { struct ext2_super_block * es ; unsigned long desc_count , bitmap_count , x ; int bitmap_nr ; struct ext2_group_desc * gdp ; int i ; es = sb -> u . ext2_sb . s_es ; desc_count = 0 ; bitmap_count = 0 ; gdp = NULL ; for ( i = 0 ; i < sb -> u . ext2_sb . s_groups_count ; i ++ ) { gdp = ext2_get_group_desc ( sb , i , NULL ) ; if ( ! gdp ) continue ; desc_count += le16_to_cpu ( gdp -> bg_free_inodes_count ) ; bitmap_nr = load_inode_bitmap ( sb , i ) ; if ( bitmap_nr < 0 ) continue ; x = ext2_count_free ( sb -> u . ext2_sb . s_inode_bitmap [ bitmap_nr ] , EXT2_INODES_PER_GROUP ( sb ) / 8 ) ; if ( le16_to_cpu ( gdp -> bg_free_inodes_count ) != x ) ext2_error ( sb , " " , " " " " , i , le16_to_cpu ( gdp -> bg_free_inodes_count ) , x ) ; bitmap_count += x ; } if ( le32_to_cpu ( es -> s_free_inodes_count ) != bitmap_count ) ext2_error ( sb , " " , " " " " , ( unsigned long ) le32_to_cpu ( es -> s_free_inodes_count ) , bitmap_count ) ; }
Called at mount-time, super-block is locked
Called at mount - time super - block is locked