diff options
-rw-r--r-- | fs/fs-writeback.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index aed881a76b2..f027382b54b 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -707,6 +707,17 @@ get_next_work_item(struct backing_dev_info *bdi) | |||
707 | return work; | 707 | return work; |
708 | } | 708 | } |
709 | 709 | ||
710 | /* | ||
711 | * Add in the number of potentially dirty inodes, because each inode | ||
712 | * write can dirty pagecache in the underlying blockdev. | ||
713 | */ | ||
714 | static unsigned long get_nr_dirty_pages(void) | ||
715 | { | ||
716 | return global_page_state(NR_FILE_DIRTY) + | ||
717 | global_page_state(NR_UNSTABLE_NFS) + | ||
718 | get_nr_dirty_inodes(); | ||
719 | } | ||
720 | |||
710 | static long wb_check_old_data_flush(struct bdi_writeback *wb) | 721 | static long wb_check_old_data_flush(struct bdi_writeback *wb) |
711 | { | 722 | { |
712 | unsigned long expired; | 723 | unsigned long expired; |
@@ -724,13 +735,7 @@ static long wb_check_old_data_flush(struct bdi_writeback *wb) | |||
724 | return 0; | 735 | return 0; |
725 | 736 | ||
726 | wb->last_old_flush = jiffies; | 737 | wb->last_old_flush = jiffies; |
727 | /* | 738 | nr_pages = get_nr_dirty_pages(); |
728 | * Add in the number of potentially dirty inodes, because each inode | ||
729 | * write can dirty pagecache in the underlying blockdev. | ||
730 | */ | ||
731 | nr_pages = global_page_state(NR_FILE_DIRTY) + | ||
732 | global_page_state(NR_UNSTABLE_NFS) + | ||
733 | get_nr_dirty_inodes(); | ||
734 | 739 | ||
735 | if (nr_pages) { | 740 | if (nr_pages) { |
736 | struct wb_writeback_work work = { | 741 | struct wb_writeback_work work = { |
@@ -1086,8 +1091,6 @@ static void wait_sb_inodes(struct super_block *sb) | |||
1086 | */ | 1091 | */ |
1087 | void writeback_inodes_sb(struct super_block *sb) | 1092 | void writeback_inodes_sb(struct super_block *sb) |
1088 | { | 1093 | { |
1089 | unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY); | ||
1090 | unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS); | ||
1091 | DECLARE_COMPLETION_ONSTACK(done); | 1094 | DECLARE_COMPLETION_ONSTACK(done); |
1092 | struct wb_writeback_work work = { | 1095 | struct wb_writeback_work work = { |
1093 | .sb = sb, | 1096 | .sb = sb, |
@@ -1097,7 +1100,7 @@ void writeback_inodes_sb(struct super_block *sb) | |||
1097 | 1100 | ||
1098 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); | 1101 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); |
1099 | 1102 | ||
1100 | work.nr_pages = nr_dirty + nr_unstable + get_nr_dirty_inodes(); | 1103 | work.nr_pages = get_nr_dirty_pages(); |
1101 | 1104 | ||
1102 | bdi_queue_work(sb->s_bdi, &work); | 1105 | bdi_queue_work(sb->s_bdi, &work); |
1103 | wait_for_completion(&done); | 1106 | wait_for_completion(&done); |