]> Pileus Git - ~andy/linux/blobdiff - fs/ext4/balloc.c
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
[~andy/linux] / fs / ext4 / balloc.c
index 1d0418980f8db58e4ce34a3c47e00ee8bcb53d01..22bc7435d9134b397f537440faa15ce890b7c44f 100644 (file)
@@ -498,44 +498,6 @@ error_return:
        return;
 }
 
-/**
- * ext4_free_blocks() -- Free given blocks and update quota
- * @handle:            handle for this transaction
- * @inode:             inode
- * @block:             start physical block to free
- * @count:             number of blocks to count
- * @metadata:          Are these metadata blocks
- */
-void ext4_free_blocks(handle_t *handle, struct inode *inode,
-                       ext4_fsblk_t block, unsigned long count,
-                       int metadata)
-{
-       struct super_block *sb;
-       unsigned long dquot_freed_blocks;
-
-       /* this isn't the right place to decide whether block is metadata
-        * inode.c/extents.c knows better, but for safety ... */
-       if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
-               metadata = 1;
-
-       /* We need to make sure we don't reuse
-        * block released untill the transaction commit.
-        * writeback mode have weak data consistency so
-        * don't force data as metadata when freeing block
-        * for writeback mode.
-        */
-       if (metadata == 0 && !ext4_should_writeback_data(inode))
-               metadata = 1;
-
-       sb = inode->i_sb;
-
-       ext4_mb_free_blocks(handle, inode, block, count,
-                           metadata, &dquot_freed_blocks);
-       if (dquot_freed_blocks)
-               vfs_dq_free_block(inode, dquot_freed_blocks);
-       return;
-}
-
 /**
  * ext4_has_free_blocks()
  * @sbi:       in-core super block structure.
@@ -761,7 +723,13 @@ static unsigned long ext4_bg_num_gdb_meta(struct super_block *sb,
 static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb,
                                        ext4_group_t group)
 {
-       return ext4_bg_has_super(sb, group) ? EXT4_SB(sb)->s_gdb_count : 0;
+       if (!ext4_bg_has_super(sb, group))
+               return 0;
+
+       if (EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG))
+               return le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg);
+       else
+               return EXT4_SB(sb)->s_gdb_count;
 }
 
 /**