aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-09-09 18:56:51 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-09-09 18:56:51 -0400
commit5704265188ffe4290ed73b3cb685206c3ed8209d (patch)
tree6bc51bea59625b2a7c8e4b74bbb66884371f74dd /fs/ext4/inode.c
parent0aa060000e83ca3d09ddc446a7174fb0820d99bc (diff)
ext4: convert s_{dirty,free}blocks_counter to s_{dirty,free}clusters_counter
Convert the percpu counters s_dirtyblocks_counter and s_freeblocks_counter in struct ext4_super_info to be s_dirtyclusters_counter and s_freeclusters_counter. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 904a9a623dab..40f51aae42fe 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -281,7 +281,7 @@ void ext4_da_update_reserve_space(struct inode *inode,
281 /* Update per-inode reservations */ 281 /* Update per-inode reservations */
282 ei->i_reserved_data_blocks -= used; 282 ei->i_reserved_data_blocks -= used;
283 ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks; 283 ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
284 percpu_counter_sub(&sbi->s_dirtyblocks_counter, 284 percpu_counter_sub(&sbi->s_dirtyclusters_counter,
285 used + ei->i_allocated_meta_blocks); 285 used + ei->i_allocated_meta_blocks);
286 ei->i_allocated_meta_blocks = 0; 286 ei->i_allocated_meta_blocks = 0;
287 287
@@ -291,7 +291,7 @@ void ext4_da_update_reserve_space(struct inode *inode,
291 * only when we have written all of the delayed 291 * only when we have written all of the delayed
292 * allocation blocks. 292 * allocation blocks.
293 */ 293 */
294 percpu_counter_sub(&sbi->s_dirtyblocks_counter, 294 percpu_counter_sub(&sbi->s_dirtyclusters_counter,
295 ei->i_reserved_meta_blocks); 295 ei->i_reserved_meta_blocks);
296 ei->i_reserved_meta_blocks = 0; 296 ei->i_reserved_meta_blocks = 0;
297 ei->i_da_metadata_calc_len = 0; 297 ei->i_da_metadata_calc_len = 0;
@@ -1119,14 +1119,14 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
1119 * only when we have written all of the delayed 1119 * only when we have written all of the delayed
1120 * allocation blocks. 1120 * allocation blocks.
1121 */ 1121 */
1122 percpu_counter_sub(&sbi->s_dirtyblocks_counter, 1122 percpu_counter_sub(&sbi->s_dirtyclusters_counter,
1123 ei->i_reserved_meta_blocks); 1123 ei->i_reserved_meta_blocks);
1124 ei->i_reserved_meta_blocks = 0; 1124 ei->i_reserved_meta_blocks = 0;
1125 ei->i_da_metadata_calc_len = 0; 1125 ei->i_da_metadata_calc_len = 0;
1126 } 1126 }
1127 1127
1128 /* update fs dirty data blocks counter */ 1128 /* update fs dirty data blocks counter */
1129 percpu_counter_sub(&sbi->s_dirtyblocks_counter, to_free); 1129 percpu_counter_sub(&sbi->s_dirtyclusters_counter, to_free);
1130 1130
1131 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1131 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1132 1132
@@ -1349,9 +1349,10 @@ static void ext4_print_free_blocks(struct inode *inode)
1349 ext4_count_free_blocks(inode->i_sb)); 1349 ext4_count_free_blocks(inode->i_sb));
1350 printk(KERN_CRIT "Free/Dirty block details\n"); 1350 printk(KERN_CRIT "Free/Dirty block details\n");
1351 printk(KERN_CRIT "free_blocks=%lld\n", 1351 printk(KERN_CRIT "free_blocks=%lld\n",
1352 (long long) percpu_counter_sum(&sbi->s_freeblocks_counter)); 1352 (long long) EXT4_C2B(EXT4_SB(inode->i_sb),
1353 percpu_counter_sum(&sbi->s_freeclusters_counter)));
1353 printk(KERN_CRIT "dirty_blocks=%lld\n", 1354 printk(KERN_CRIT "dirty_blocks=%lld\n",
1354 (long long) percpu_counter_sum(&sbi->s_dirtyblocks_counter)); 1355 (long long) percpu_counter_sum(&sbi->s_dirtyclusters_counter));
1355 printk(KERN_CRIT "Block reservation details\n"); 1356 printk(KERN_CRIT "Block reservation details\n");
1356 printk(KERN_CRIT "i_reserved_data_blocks=%u\n", 1357 printk(KERN_CRIT "i_reserved_data_blocks=%u\n",
1357 EXT4_I(inode)->i_reserved_data_blocks); 1358 EXT4_I(inode)->i_reserved_data_blocks);
@@ -2226,8 +2227,9 @@ static int ext4_nonda_switch(struct super_block *sb)
2226 * Delalloc need an accurate free block accounting. So switch 2227 * Delalloc need an accurate free block accounting. So switch
2227 * to non delalloc when we are near to error range. 2228 * to non delalloc when we are near to error range.
2228 */ 2229 */
2229 free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); 2230 free_blocks = EXT4_C2B(sbi,
2230 dirty_blocks = percpu_counter_read_positive(&sbi->s_dirtyblocks_counter); 2231 percpu_counter_read_positive(&sbi->s_freeclusters_counter));
2232 dirty_blocks = percpu_counter_read_positive(&sbi->s_dirtyclusters_counter);
2231 if (2 * free_blocks < 3 * dirty_blocks || 2233 if (2 * free_blocks < 3 * dirty_blocks ||
2232 free_blocks < (dirty_blocks + EXT4_FREEBLOCKS_WATERMARK)) { 2234 free_blocks < (dirty_blocks + EXT4_FREEBLOCKS_WATERMARK)) {
2233 /* 2235 /*