nfs: fix some issues in nfs41_proc_reclaim_complete()
[safe/jmp/linux-2.6] / fs / ext3 / balloc.c
index f5b57a2..a177122 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/time.h>
 #include <linux/capability.h>
 #include <linux/fs.h>
+#include <linux/slab.h>
 #include <linux/jbd.h>
 #include <linux/ext3_fs.h>
 #include <linux/ext3_jbd.h>
@@ -649,7 +650,7 @@ do_more:
                count = overflow;
                goto do_more;
        }
-       sb->s_dirt = 1;
+
 error_return:
        brelse(bitmap_bh);
        ext3_std_error(sb, err);
@@ -676,7 +677,7 @@ void ext3_free_blocks(handle_t *handle, struct inode *inode,
        }
        ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks);
        if (dquot_freed_blocks)
-               DQUOT_FREE_BLOCK(inode, dquot_freed_blocks);
+               dquot_free_block(inode, dquot_freed_blocks);
        return;
 }
 
@@ -1422,7 +1423,7 @@ static int ext3_has_free_blocks(struct ext3_sb_info *sbi)
        free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
        root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count);
        if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) &&
-               sbi->s_resuid != current->fsuid &&
+               sbi->s_resuid != current_fsuid() &&
                (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) {
                return 0;
        }
@@ -1502,8 +1503,9 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
        /*
         * Check quota for allocation of this block.
         */
-       if (DQUOT_ALLOC_BLOCK(inode, num)) {
-               *errp = -EDQUOT;
+       err = dquot_alloc_block(inode, num);
+       if (err) {
+               *errp = err;
                return 0;
        }
 
@@ -1708,13 +1710,12 @@ allocated:
        if (!fatal)
                fatal = err;
 
-       sb->s_dirt = 1;
        if (fatal)
                goto out;
 
        *errp = 0;
        brelse(bitmap_bh);
-       DQUOT_FREE_BLOCK(inode, *count-num);
+       dquot_free_block(inode, *count-num);
        *count = num;
        return ret_block;
 
@@ -1729,7 +1730,7 @@ out:
         * Undo the block allocation
         */
        if (!performed_allocation)
-               DQUOT_FREE_BLOCK(inode, *count);
+               dquot_free_block(inode, *count);
        brelse(bitmap_bh);
        return 0;
 }