cifs: fix noserverino handling when unix extensions are enabled
[safe/jmp/linux-2.6] / fs / ocfs2 / dir.c
index de490a6..efd77d0 100644 (file)
@@ -2439,7 +2439,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
        dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data;
        memset(dx_root, 0, osb->sb->s_blocksize);
        strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE);
-       dx_root->dr_suballoc_slot = cpu_to_le16(osb->slot_num);
+       dx_root->dr_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot);
        dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit);
        dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation);
        dx_root->dr_blkno = cpu_to_le64(dr_blkno);
@@ -2903,7 +2903,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
        struct ocfs2_extent_tree dx_et;
        int did_quota = 0, bytes_allocated = 0;
 
-       ocfs2_init_dinode_extent_tree(&et, dir, di_bh);
+       ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(dir), di_bh);
 
        alloc = ocfs2_clusters_for_bytes(sb, bytes);
        dx_alloc = 0;
@@ -2964,12 +2964,10 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
                goto out;
        }
 
-       if (vfs_dq_alloc_space_nodirty(dir,
-                               ocfs2_clusters_to_bytes(osb->sb,
-                                                       alloc + dx_alloc))) {
-               ret = -EDQUOT;
+       ret = dquot_alloc_space_nodirty(dir,
+               ocfs2_clusters_to_bytes(osb->sb, alloc + dx_alloc));
+       if (ret)
                goto out_commit;
-       }
        did_quota = 1;
 
        if (ocfs2_supports_indexed_dirs(osb) && !dx_inline) {
@@ -3125,7 +3123,9 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
                        ocfs2_dx_dir_index_root_block(dir, dx_root_bh,
                                                      dirdata_bh);
                } else {
-                       ocfs2_init_dx_root_extent_tree(&dx_et, dir, dx_root_bh);
+                       ocfs2_init_dx_root_extent_tree(&dx_et,
+                                                      INODE_CACHE(dir),
+                                                      dx_root_bh);
                        ret = ocfs2_insert_extent(handle, &dx_et, 0,
                                                  dx_insert_blkno, 1, 0, NULL);
                        if (ret)
@@ -3176,7 +3176,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
 
 out_commit:
        if (ret < 0 && did_quota)
-               vfs_dq_free_space_nodirty(dir, bytes_allocated);
+               dquot_free_space_nodirty(dir, bytes_allocated);
 
        ocfs2_commit_trans(osb, handle);
 
@@ -3219,11 +3219,10 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
        if (extend) {
                u32 offset = OCFS2_I(dir)->ip_clusters;
 
-               if (vfs_dq_alloc_space_nodirty(dir,
-                                       ocfs2_clusters_to_bytes(sb, 1))) {
-                       status = -EDQUOT;
+               status = dquot_alloc_space_nodirty(dir,
+                                       ocfs2_clusters_to_bytes(sb, 1));
+               if (status)
                        goto bail;
-               }
                did_quota = 1;
 
                status = ocfs2_add_inode_data(OCFS2_SB(sb), dir, &offset,
@@ -3252,7 +3251,7 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
        status = 0;
 bail:
        if (did_quota && status < 0)
-               vfs_dq_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1));
+               dquot_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1));
        mlog_exit(status);
        return status;
 }
@@ -3345,7 +3344,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
        spin_lock(&OCFS2_I(dir)->ip_lock);
        if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) {
                spin_unlock(&OCFS2_I(dir)->ip_lock);
-               ocfs2_init_dinode_extent_tree(&et, dir, parent_fe_bh);
+               ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(dir),
+                                             parent_fe_bh);
                num_free_extents = ocfs2_num_free_extents(osb, &et);
                if (num_free_extents < 0) {
                        status = num_free_extents;
@@ -3837,7 +3837,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
             (unsigned long long)OCFS2_I(dir)->ip_blkno,
             (unsigned long long)leaf_blkno, insert_hash);
 
-       ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh);
+       ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh);
 
        dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data;
        /*
@@ -3886,11 +3886,10 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
                goto out;
        }
 
-       if (vfs_dq_alloc_space_nodirty(dir,
-                                      ocfs2_clusters_to_bytes(dir->i_sb, 1))) {
-               ret = -EDQUOT;
+       ret = dquot_alloc_space_nodirty(dir,
+                                      ocfs2_clusters_to_bytes(dir->i_sb, 1));
+       if (ret)
                goto out_commit;
-       }
        did_quota = 1;
 
        ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh,
@@ -3980,7 +3979,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
 
 out_commit:
        if (ret < 0 && did_quota)
-               vfs_dq_free_space_nodirty(dir,
+               dquot_free_space_nodirty(dir,
                                ocfs2_clusters_to_bytes(dir->i_sb, 1));
 
        ocfs2_commit_trans(osb, handle);
@@ -4162,11 +4161,10 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
                goto out;
        }
 
-       if (vfs_dq_alloc_space_nodirty(dir,
-                                      ocfs2_clusters_to_bytes(osb->sb, 1))) {
-               ret = -EDQUOT;
+       ret = dquot_alloc_space_nodirty(dir,
+                                      ocfs2_clusters_to_bytes(osb->sb, 1));
+       if (ret)
                goto out_commit;
-       }
        did_quota = 1;
 
        /*
@@ -4216,7 +4214,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
 
        /* This should never fail considering we start with an empty
         * dx_root. */
-       ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh);
+       ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh);
        ret = ocfs2_insert_extent(handle, &et, 0, insert_blkno, 1, 0, NULL);
        if (ret)
                mlog_errno(ret);
@@ -4226,7 +4224,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
 
 out_commit:
        if (ret < 0 && did_quota)
-               vfs_dq_free_space_nodirty(dir,
+               dquot_free_space_nodirty(dir,
                                          ocfs2_clusters_to_bytes(dir->i_sb, 1));
 
        ocfs2_commit_trans(osb, handle);
@@ -4540,7 +4538,7 @@ int ocfs2_dx_dir_truncate(struct inode *dir, struct buffer_head *di_bh)
        if (ocfs2_dx_root_inline(dx_root))
                goto remove_index;
 
-       ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh);
+       ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh);
 
        /* XXX: What if dr_clusters is too large? */
        while (le32_to_cpu(dx_root->dr_clusters)) {