ext3: use unsigned instead of int for type of blocksize in fs/ext3/namei.c
[safe/jmp/linux-2.6] / fs / ext3 / ialloc.c
index 47b678d..dd13d60 100644 (file)
@@ -123,10 +123,10 @@ void ext3_free_inode (handle_t *handle, struct inode * inode)
         * Note: we must free any quota before locking the superblock,
         * as writing the quota to disk may need the lock as well.
         */
-       DQUOT_INIT(inode);
+       vfs_dq_init(inode);
        ext3_xattr_delete_inode(handle, inode);
-       DQUOT_FREE_INODE(inode);
-       DQUOT_DROP(inode);
+       vfs_dq_free_inode(inode);
+       vfs_dq_drop(inode);
 
        is_directory = S_ISDIR(inode->i_mode);
 
@@ -539,7 +539,7 @@ got:
                percpu_counter_inc(&sbi->s_dirs_counter);
        sb->s_dirt = 1;
 
-       inode->i_uid = current->fsuid;
+       inode->i_uid = current_fsuid();
        if (test_opt (sb, GRPID))
                inode->i_gid = dir->i_gid;
        else if (dir->i_mode & S_ISGID) {
@@ -547,7 +547,7 @@ got:
                if (S_ISDIR(mode))
                        mode |= S_ISGID;
        } else
-               inode->i_gid = current->fsgid;
+               inode->i_gid = current_fsgid();
        inode->i_mode = mode;
 
        inode->i_ino = ino;
@@ -559,12 +559,8 @@ got:
        ei->i_dir_start_lookup = 0;
        ei->i_disksize = 0;
 
-       ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
-       if (S_ISLNK(mode))
-               ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
-       /* dirsync only applies to directories */
-       if (!S_ISDIR(mode))
-               ei->i_flags &= ~EXT3_DIRSYNC_FL;
+       ei->i_flags =
+               ext3_mask_flags(mode, EXT3_I(dir)->i_flags & EXT3_FL_INHERITED);
 #ifdef EXT3_FRAGMENTS
        ei->i_faddr = 0;
        ei->i_frag_no = 0;
@@ -579,7 +575,10 @@ got:
        ext3_set_inode_flags(inode);
        if (IS_DIRSYNC(inode))
                handle->h_sync = 1;
-       insert_inode_hash(inode);
+       if (insert_inode_locked(inode) < 0) {
+               err = -EINVAL;
+               goto fail_drop;
+       }
        spin_lock(&sbi->s_next_gen_lock);
        inode->i_generation = sbi->s_next_generation++;
        spin_unlock(&sbi->s_next_gen_lock);
@@ -590,7 +589,7 @@ got:
                sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
 
        ret = inode;
-       if(DQUOT_ALLOC_INODE(inode)) {
+       if (vfs_dq_alloc_inode(inode)) {
                err = -EDQUOT;
                goto fail_drop;
        }
@@ -621,12 +620,13 @@ really_out:
        return ret;
 
 fail_free_drop:
-       DQUOT_FREE_INODE(inode);
+       vfs_dq_free_inode(inode);
 
 fail_drop:
-       DQUOT_DROP(inode);
+       vfs_dq_drop(inode);
        inode->i_flags |= S_NOQUOTA;
        inode->i_nlink = 0;
+       unlock_new_inode(inode);
        iput(inode);
        brelse(bitmap_bh);
        return ERR_PTR(err);