aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--mm/page-writeback.c12
2 files changed, 11 insertions, 2 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index bfae09d2a1eb..4d9222c2f222 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -28,6 +28,7 @@ typedef int (congested_fn)(void *, int);
28 28
29enum bdi_stat_item { 29enum bdi_stat_item {
30 BDI_RECLAIMABLE, 30 BDI_RECLAIMABLE,
31 BDI_WRITEBACK,
31 NR_BDI_STAT_ITEMS 32 NR_BDI_STAT_ITEMS
32}; 33};
33 34
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 9b3c4ee62abf..f1d201fdcf9c 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -979,14 +979,18 @@ int test_clear_page_writeback(struct page *page)
979 int ret; 979 int ret;
980 980
981 if (mapping) { 981 if (mapping) {
982 struct backing_dev_info *bdi = mapping->backing_dev_info;
982 unsigned long flags; 983 unsigned long flags;
983 984
984 write_lock_irqsave(&mapping->tree_lock, flags); 985 write_lock_irqsave(&mapping->tree_lock, flags);
985 ret = TestClearPageWriteback(page); 986 ret = TestClearPageWriteback(page);
986 if (ret) 987 if (ret) {
987 radix_tree_tag_clear(&mapping->page_tree, 988 radix_tree_tag_clear(&mapping->page_tree,
988 page_index(page), 989 page_index(page),
989 PAGECACHE_TAG_WRITEBACK); 990 PAGECACHE_TAG_WRITEBACK);
991 if (bdi_cap_writeback_dirty(bdi))
992 __dec_bdi_stat(bdi, BDI_WRITEBACK);
993 }
990 write_unlock_irqrestore(&mapping->tree_lock, flags); 994 write_unlock_irqrestore(&mapping->tree_lock, flags);
991 } else { 995 } else {
992 ret = TestClearPageWriteback(page); 996 ret = TestClearPageWriteback(page);
@@ -1002,14 +1006,18 @@ int test_set_page_writeback(struct page *page)
1002 int ret; 1006 int ret;
1003 1007
1004 if (mapping) { 1008 if (mapping) {
1009 struct backing_dev_info *bdi = mapping->backing_dev_info;
1005 unsigned long flags; 1010 unsigned long flags;
1006 1011
1007 write_lock_irqsave(&mapping->tree_lock, flags); 1012 write_lock_irqsave(&mapping->tree_lock, flags);
1008 ret = TestSetPageWriteback(page); 1013 ret = TestSetPageWriteback(page);
1009 if (!ret) 1014 if (!ret) {
1010 radix_tree_tag_set(&mapping->page_tree, 1015 radix_tree_tag_set(&mapping->page_tree,
1011 page_index(page), 1016 page_index(page),
1012 PAGECACHE_TAG_WRITEBACK); 1017 PAGECACHE_TAG_WRITEBACK);
1018 if (bdi_cap_writeback_dirty(bdi))
1019 __inc_bdi_stat(bdi, BDI_WRITEBACK);
1020 }
1013 if (!PageDirty(page)) 1021 if (!PageDirty(page))
1014 radix_tree_tag_clear(&mapping->page_tree, 1022 radix_tree_tag_clear(&mapping->page_tree,
1015 page_index(page), 1023 page_index(page),