btrfs: replace inode uid,gid,mode initialization with helper function
[safe/jmp/linux-2.6] / fs / ext2 / ialloc.c
index 66321a8..f0c5286 100644 (file)
@@ -106,7 +106,7 @@ void ext2_free_inode (struct inode * inode)
        struct super_block * sb = inode->i_sb;
        int is_directory;
        unsigned long ino;
-       struct buffer_head *bitmap_bh = NULL;
+       struct buffer_head *bitmap_bh;
        unsigned long block_group;
        unsigned long bit;
        struct ext2_super_block * es;
@@ -121,8 +121,8 @@ void ext2_free_inode (struct inode * inode)
        if (!is_bad_inode(inode)) {
                /* Quota is already initialized in iput() */
                ext2_xattr_delete_inode(inode);
-               DQUOT_FREE_INODE(inode);
-               DQUOT_DROP(inode);
+               dquot_free_inode(inode);
+               dquot_drop(inode);
        }
 
        es = EXT2_SB(sb)->s_es;
@@ -135,14 +135,13 @@ void ext2_free_inode (struct inode * inode)
            ino > le32_to_cpu(es->s_inodes_count)) {
                ext2_error (sb, "ext2_free_inode",
                            "reserved or nonexistent inode %lu", ino);
-               goto error_return;
+               return;
        }
        block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb);
        bit = (ino - 1) % EXT2_INODES_PER_GROUP(sb);
-       brelse(bitmap_bh);
        bitmap_bh = read_inode_bitmap(sb, block_group);
        if (!bitmap_bh)
-               goto error_return;
+               return;
 
        /* Ok, now we can actually update the inode bitmaps.. */
        if (!ext2_clear_bit_atomic(sb_bgl_lock(EXT2_SB(sb), block_group),
@@ -154,7 +153,7 @@ void ext2_free_inode (struct inode * inode)
        mark_buffer_dirty(bitmap_bh);
        if (sb->s_flags & MS_SYNCHRONOUS)
                sync_dirty_buffer(bitmap_bh);
-error_return:
+
        brelse(bitmap_bh);
 }
 
@@ -586,10 +585,10 @@ got:
                goto fail_drop;
        }
 
-       if (DQUOT_ALLOC_INODE(inode)) {
-               err = -EDQUOT;
+       dquot_initialize(inode);
+       err = dquot_alloc_inode(inode);
+       if (err)
                goto fail_drop;
-       }
 
        err = ext2_init_acl(inode, dir);
        if (err)
@@ -605,10 +604,10 @@ got:
        return inode;
 
 fail_free_drop:
-       DQUOT_FREE_INODE(inode);
+       dquot_free_inode(inode);
 
 fail_drop:
-       DQUOT_DROP(inode);
+       dquot_drop(inode);
        inode->i_flags |= S_NOQUOTA;
        inode->i_nlink = 0;
        unlock_new_inode(inode);