diff options
author | Mingming Cao <cmm@us.ibm.com> | 2008-07-11 19:27:31 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-07-11 19:27:31 -0400 |
commit | e8ced39d5e8911c662d4d69a342b9d053eaaac4e (patch) | |
tree | cd4d643bfbd37c67ff9bd2feff2c0b477a56f117 /fs | |
parent | 64769240bd07f446f83660bb143bb609d8ab4910 (diff) |
percpu_counter: new function percpu_counter_sum_and_set
Delayed allocation need to check free blocks at every write time.
percpu_counter_read_positive() is not quit accurate. delayed
allocation need a more accurate accounting, but using
percpu_counter_sum_positive() is frequently is quite expensive.
This patch added a new function to update center counter when sum
per-cpu counter, to increase the accurate rate for next
percpu_counter_read() and require less calling expensive
percpu_counter_sum().
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/balloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 25f63d8c1b3d..6369bacf0dcb 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -1621,7 +1621,7 @@ ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi, | |||
1621 | #ifdef CONFIG_SMP | 1621 | #ifdef CONFIG_SMP |
1622 | if (free_blocks - root_blocks < FBC_BATCH) | 1622 | if (free_blocks - root_blocks < FBC_BATCH) |
1623 | free_blocks = | 1623 | free_blocks = |
1624 | percpu_counter_sum_positive(&sbi->s_freeblocks_counter); | 1624 | percpu_counter_sum_and_set(&sbi->s_freeblocks_counter); |
1625 | #endif | 1625 | #endif |
1626 | if (free_blocks - root_blocks < nblocks) | 1626 | if (free_blocks - root_blocks < nblocks) |
1627 | return free_blocks - root_blocks; | 1627 | return free_blocks - root_blocks; |