aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/inode.c17
-rw-r--r--fs/fs-writeback.c1
2 files changed, 11 insertions, 7 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ca76b5ed6c9e..0a31197590d7 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2462,6 +2462,16 @@ static int ext4_nonda_switch(struct super_block *sb)
2462 free_blocks = EXT4_C2B(sbi, 2462 free_blocks = EXT4_C2B(sbi,
2463 percpu_counter_read_positive(&sbi->s_freeclusters_counter)); 2463 percpu_counter_read_positive(&sbi->s_freeclusters_counter));
2464 dirty_blocks = percpu_counter_read_positive(&sbi->s_dirtyclusters_counter); 2464 dirty_blocks = percpu_counter_read_positive(&sbi->s_dirtyclusters_counter);
2465 /*
2466 * Start pushing delalloc when 1/2 of free blocks are dirty.
2467 */
2468 if (dirty_blocks && (free_blocks < 2 * dirty_blocks) &&
2469 !writeback_in_progress(sb->s_bdi) &&
2470 down_read_trylock(&sb->s_umount)) {
2471 writeback_inodes_sb(sb, WB_REASON_FS_FREE_SPACE);
2472 up_read(&sb->s_umount);
2473 }
2474
2465 if (2 * free_blocks < 3 * dirty_blocks || 2475 if (2 * free_blocks < 3 * dirty_blocks ||
2466 free_blocks < (dirty_blocks + EXT4_FREECLUSTERS_WATERMARK)) { 2476 free_blocks < (dirty_blocks + EXT4_FREECLUSTERS_WATERMARK)) {
2467 /* 2477 /*
@@ -2470,13 +2480,6 @@ static int ext4_nonda_switch(struct super_block *sb)
2470 */ 2480 */
2471 return 1; 2481 return 1;
2472 } 2482 }
2473 /*
2474 * Even if we don't switch but are nearing capacity,
2475 * start pushing delalloc when 1/2 of free blocks are dirty.
2476 */
2477 if (free_blocks < 2 * dirty_blocks)
2478 writeback_inodes_sb_if_idle(sb, WB_REASON_FS_FREE_SPACE);
2479
2480 return 0; 2483 return 0;
2481} 2484}
2482 2485
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index be3efc4f64f4..5602d73d4ec7 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -63,6 +63,7 @@ int writeback_in_progress(struct backing_dev_info *bdi)
63{ 63{
64 return test_bit(BDI_writeback_running, &bdi->state); 64 return test_bit(BDI_writeback_running, &bdi->state);
65} 65}
66EXPORT_SYMBOL(writeback_in_progress);
66 67
67static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) 68static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
68{ 69{