aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext2/balloc.c2
-rw-r--r--fs/ext3/balloc.c2
-rw-r--r--fs/ext4/balloc.c2
-rw-r--r--include/linux/percpu_counter.h5
4 files changed, 8 insertions, 3 deletions
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 53be25158560..9157fcf887bc 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -124,7 +124,7 @@ static int reserve_blocks(struct super_block *sb, int count)
124 return 0; 124 return 0;
125 } 125 }
126 126
127 percpu_counter_add(&sbi->s_freeblocks_counter, -count); 127 percpu_counter_sub(&sbi->s_freeblocks_counter, count);
128 sb->s_dirt = 1; 128 sb->s_dirt = 1;
129 return count; 129 return count;
130} 130}
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index df575673e02d..d3758ee9cb5b 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -1633,7 +1633,7 @@ allocated:
1633 gdp->bg_free_blocks_count = 1633 gdp->bg_free_blocks_count =
1634 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num); 1634 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
1635 spin_unlock(sb_bgl_lock(sbi, group_no)); 1635 spin_unlock(sb_bgl_lock(sbi, group_no));
1636 percpu_counter_add(&sbi->s_freeblocks_counter, -num); 1636 percpu_counter_sub(&sbi->s_freeblocks_counter, num);
1637 1637
1638 BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor"); 1638 BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor");
1639 err = ext3_journal_dirty_metadata(handle, gdp_bh); 1639 err = ext3_journal_dirty_metadata(handle, gdp_bh);
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index a141456cd491..8d59eec2e82b 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -1647,7 +1647,7 @@ allocated:
1647 gdp->bg_free_blocks_count = 1647 gdp->bg_free_blocks_count =
1648 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num); 1648 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
1649 spin_unlock(sb_bgl_lock(sbi, group_no)); 1649 spin_unlock(sb_bgl_lock(sbi, group_no));
1650 percpu_counter_add(&sbi->s_freeblocks_counter, -num); 1650 percpu_counter_sub(&sbi->s_freeblocks_counter, num);
1651 1651
1652 BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor"); 1652 BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor");
1653 err = ext4_journal_dirty_metadata(handle, gdp_bh); 1653 err = ext4_journal_dirty_metadata(handle, gdp_bh);
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index b84fc8667de8..438a170187ec 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -105,4 +105,9 @@ static inline void percpu_counter_dec(struct percpu_counter *fbc)
105 percpu_counter_add(fbc, -1); 105 percpu_counter_add(fbc, -1);
106} 106}
107 107
108static inline void percpu_counter_sub(struct percpu_counter *fbc, s64 amount)
109{
110 percpu_counter_add(fbc, -amount);
111}
112
108#endif /* _LINUX_PERCPU_COUNTER_H */ 113#endif /* _LINUX_PERCPU_COUNTER_H */