Merge branch 'master' into upstream
[pandora-kernel.git] / fs / ext3 / ialloc.c
index 6549945..36546ed 100644 (file)
@@ -262,9 +262,11 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
        int ngroups = sbi->s_groups_count;
        int inodes_per_group = EXT3_INODES_PER_GROUP(sb);
        int freei, avefreei;
-       int freeb, avefreeb;
-       int blocks_per_dir, ndirs;
-       int max_debt, max_dirs, min_blocks, min_inodes;
+       ext3_fsblk_t freeb, avefreeb;
+       ext3_fsblk_t blocks_per_dir;
+       int ndirs;
+       int max_debt, max_dirs, min_inodes;
+       ext3_grpblk_t min_blocks;
        int group = -1, i;
        struct ext3_group_desc *desc;
        struct buffer_head *bh;
@@ -307,7 +309,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
        min_inodes = avefreei - inodes_per_group / 4;
        min_blocks = avefreeb - EXT3_BLOCKS_PER_GROUP(sb) / 4;
 
-       max_debt = EXT3_BLOCKS_PER_GROUP(sb) / max(blocks_per_dir, BLOCK_COST);
+       max_debt = EXT3_BLOCKS_PER_GROUP(sb) / max(blocks_per_dir, (ext3_fsblk_t)BLOCK_COST);
        if (max_debt * INODE_COST > inodes_per_group)
                max_debt = inodes_per_group / INODE_COST;
        if (max_debt > 255)
@@ -650,7 +652,7 @@ struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino)
        /* Error cases - e2fsck has already cleaned up for us */
        if (ino > max_ino) {
                ext3_warning(sb, __FUNCTION__,
-                            "bad orphan ino %lu!  e2fsck was run?\n", ino);
+                            "bad orphan ino %lu!  e2fsck was run?", ino);
                goto out;
        }
 
@@ -659,7 +661,7 @@ struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino)
        bitmap_bh = read_inode_bitmap(sb, block_group);
        if (!bitmap_bh) {
                ext3_warning(sb, __FUNCTION__,
-                            "inode bitmap error for orphan %lu\n", ino);
+                            "inode bitmap error for orphan %lu", ino);
                goto out;
        }
 
@@ -671,7 +673,7 @@ struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino)
                        !(inode = iget(sb, ino)) || is_bad_inode(inode) ||
                        NEXT_ORPHAN(inode) > max_ino) {
                ext3_warning(sb, __FUNCTION__,
-                            "bad orphan inode %lu!  e2fsck was run?\n", ino);
+                            "bad orphan inode %lu!  e2fsck was run?", ino);
                printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n",
                       bit, (unsigned long long)bitmap_bh->b_blocknr,
                       ext3_test_bit(bit, bitmap_bh->b_data));
@@ -704,7 +706,6 @@ unsigned long ext3_count_free_inodes (struct super_block * sb)
        unsigned long bitmap_count, x;
        struct buffer_head *bitmap_bh = NULL;
 
-       lock_super (sb);
        es = EXT3_SB(sb)->s_es;
        desc_count = 0;
        bitmap_count = 0;
@@ -727,7 +728,6 @@ unsigned long ext3_count_free_inodes (struct super_block * sb)
        brelse(bitmap_bh);
        printk("ext3_count_free_inodes: stored = %u, computed = %lu, %lu\n",
                le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count);
-       unlock_super(sb);
        return desc_count;
 #else
        desc_count = 0;
@@ -757,44 +757,3 @@ unsigned long ext3_count_dirs (struct super_block * sb)
        return count;
 }
 
-#ifdef CONFIG_EXT3_CHECK
-/* Called at mount-time, super-block is locked */
-void ext3_check_inodes_bitmap (struct super_block * sb)
-{
-       struct ext3_super_block * es;
-       unsigned long desc_count, bitmap_count, x;
-       struct buffer_head *bitmap_bh = NULL;
-       struct ext3_group_desc * gdp;
-       int i;
-
-       es = EXT3_SB(sb)->s_es;
-       desc_count = 0;
-       bitmap_count = 0;
-       gdp = NULL;
-       for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
-               gdp = ext3_get_group_desc (sb, i, NULL);
-               if (!gdp)
-                       continue;
-               desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
-               brelse(bitmap_bh);
-               bitmap_bh = read_inode_bitmap(sb, i);
-               if (!bitmap_bh)
-                       continue;
-
-               x = ext3_count_free(bitmap_bh, EXT3_INODES_PER_GROUP(sb) / 8);
-               if (le16_to_cpu(gdp->bg_free_inodes_count) != x)
-                       ext3_error (sb, "ext3_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;
-       }
-       brelse(bitmap_bh);
-       if (le32_to_cpu(es->s_free_inodes_count) != bitmap_count)
-               ext3_error (sb, "ext3_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);
-}
-#endif