aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/balloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/balloc.c')
-rw-r--r--fs/ext2/balloc.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 2616d0ea5c5c..9f9992b37924 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -159,15 +159,6 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
159 return bh; 159 return bh;
160} 160}
161 161
162static void release_blocks(struct super_block *sb, int count)
163{
164 if (count) {
165 struct ext2_sb_info *sbi = EXT2_SB(sb);
166
167 percpu_counter_add(&sbi->s_freeblocks_counter, count);
168 }
169}
170
171static void group_adjust_blocks(struct super_block *sb, int group_no, 162static void group_adjust_blocks(struct super_block *sb, int group_no,
172 struct ext2_group_desc *desc, struct buffer_head *bh, int count) 163 struct ext2_group_desc *desc, struct buffer_head *bh, int count)
173{ 164{
@@ -568,8 +559,11 @@ do_more:
568 } 559 }
569error_return: 560error_return:
570 brelse(bitmap_bh); 561 brelse(bitmap_bh);
571 release_blocks(sb, freed); 562 if (freed) {
572 dquot_free_block_nodirty(inode, freed); 563 percpu_counter_add(&sbi->s_freeblocks_counter, freed);
564 dquot_free_block_nodirty(inode, freed);
565 mark_inode_dirty(inode);
566 }
573} 567}
574 568
575/** 569/**
@@ -1239,10 +1233,6 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
1239 1233
1240 *errp = -ENOSPC; 1234 *errp = -ENOSPC;
1241 sb = inode->i_sb; 1235 sb = inode->i_sb;
1242 if (!sb) {
1243 printk("ext2_new_blocks: nonexistent device");
1244 return 0;
1245 }
1246 1236
1247 /* 1237 /*
1248 * Check quota for allocation of this block. 1238 * Check quota for allocation of this block.
@@ -1416,9 +1406,11 @@ allocated:
1416 1406
1417 *errp = 0; 1407 *errp = 0;
1418 brelse(bitmap_bh); 1408 brelse(bitmap_bh);
1419 dquot_free_block_nodirty(inode, *count-num); 1409 if (num < *count) {
1420 mark_inode_dirty(inode); 1410 dquot_free_block_nodirty(inode, *count-num);
1421 *count = num; 1411 mark_inode_dirty(inode);
1412 *count = num;
1413 }
1422 return ret_block; 1414 return ret_block;
1423 1415
1424io_error: 1416io_error: