]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/ext4/ialloc.c
Merge branches 'sh/pio-death', 'sh/nommu', 'sh/clkfwk', 'sh/core' and 'sh/intc-extens...
[net-next-2.6.git] / fs / ext4 / ialloc.c
index e428f23215c0025dbddcba7e8685380fb268496c..1ce240a23ebb84963ce2126b78f126657fd7d6df 100644 (file)
@@ -50,7 +50,7 @@
  * need to use it within a single byte (to ensure we get endianness right).
  * We can use memset for the rest of the bitmap as there are no other users.
  */
-void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
 {
        int i;
 
@@ -65,9 +65,10 @@ void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
 }
 
 /* Initializes an uninitialized inode bitmap */
-unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh,
-                               ext4_group_t block_group,
-                               struct ext4_group_desc *gdp)
+static unsigned ext4_init_inode_bitmap(struct super_block *sb,
+                                      struct buffer_head *bh,
+                                      ext4_group_t block_group,
+                                      struct ext4_group_desc *gdp)
 {
        struct ext4_sb_info *sbi = EXT4_SB(sb);
 
@@ -85,7 +86,7 @@ unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh,
        }
 
        memset(bh->b_data, 0, (EXT4_INODES_PER_GROUP(sb) + 7) / 8);
-       mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), sb->s_blocksize * 8,
+       ext4_mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), sb->s_blocksize * 8,
                        bh->b_data);
 
        return EXT4_INODES_PER_GROUP(sb);
@@ -414,8 +415,8 @@ struct orlov_stats {
  * for a particular block group or flex_bg.  If flex_size is 1, then g
  * is a block group number; otherwise it is flex_bg number.
  */
-void get_orlov_stats(struct super_block *sb, ext4_group_t g,
-                      int flex_size, struct orlov_stats *stats)
+static void get_orlov_stats(struct super_block *sb, ext4_group_t g,
+                           int flex_size, struct orlov_stats *stats)
 {
        struct ext4_group_desc *desc;
        struct flex_groups *flex_group = EXT4_SB(sb)->s_flex_groups;
@@ -1238,7 +1239,6 @@ extern int ext4_init_inode_table(struct super_block *sb, ext4_group_t group,
        handle_t *handle;
        ext4_fsblk_t blk;
        int num, ret = 0, used_blks = 0;
-       unsigned long flags = BLKDEV_IFL_WAIT;
 
        /* This should not happen, but just to be sure check this */
        if (sb->s_flags & MS_RDONLY) {
@@ -1274,6 +1274,16 @@ extern int ext4_init_inode_table(struct super_block *sb, ext4_group_t group,
                            ext4_itable_unused_count(sb, gdp)),
                            sbi->s_inodes_per_block);
 
+       if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group)) {
+               ext4_error(sb, "Something is wrong with group %u\n"
+                          "Used itable blocks: %d"
+                          "itable unused count: %u\n",
+                          group, used_blks,
+                          ext4_itable_unused_count(sb, gdp));
+               ret = 1;
+               goto out;
+       }
+
        blk = ext4_inode_table(sb, gdp) + used_blks;
        num = sbi->s_itb_per_group - used_blks;
 
@@ -1283,15 +1293,6 @@ extern int ext4_init_inode_table(struct super_block *sb, ext4_group_t group,
        if (ret)
                goto err_out;
 
-       if (unlikely(num > EXT4_INODES_PER_GROUP(sb))) {
-               ext4_error(sb, "Something is wrong with group %u\n"
-                          "Used itable blocks: %d"
-                          "Itable blocks per group: %lu\n",
-                          group, used_blks, sbi->s_itb_per_group);
-               ret = 1;
-               goto err_out;
-       }
-
        /*
         * Skip zeroout if the inode table is full. But we set the ZEROED
         * flag anyway, because obviously, when it is full it does not need
@@ -1302,11 +1303,11 @@ extern int ext4_init_inode_table(struct super_block *sb, ext4_group_t group,
 
        ext4_debug("going to zero out inode table in group %d\n",
                   group);
-       if (barrier)
-               flags |= BLKDEV_IFL_BARRIER;
-       ret = sb_issue_zeroout(sb, blk, num, GFP_NOFS, flags);
+       ret = sb_issue_zeroout(sb, blk, num, GFP_NOFS);
        if (ret < 0)
                goto err_out;
+       if (barrier)
+               blkdev_issue_flush(sb->s_bdev, GFP_NOFS, NULL);
 
 skip_zeroout:
        ext4_lock_group(sb, group);