Commit 69cb51d1 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Linus Torvalds

mm: count writeback pages per BDI

Count per BDI writeback pages.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c9e51e41
...@@ -28,6 +28,7 @@ typedef int (congested_fn)(void *, int); ...@@ -28,6 +28,7 @@ typedef int (congested_fn)(void *, int);
enum bdi_stat_item { enum bdi_stat_item {
BDI_RECLAIMABLE, BDI_RECLAIMABLE,
BDI_WRITEBACK,
NR_BDI_STAT_ITEMS NR_BDI_STAT_ITEMS
}; };
......
...@@ -979,14 +979,18 @@ int test_clear_page_writeback(struct page *page) ...@@ -979,14 +979,18 @@ int test_clear_page_writeback(struct page *page)
int ret; int ret;
if (mapping) { if (mapping) {
struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags; unsigned long flags;
write_lock_irqsave(&mapping->tree_lock, flags); write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestClearPageWriteback(page); ret = TestClearPageWriteback(page);
if (ret) if (ret) {
radix_tree_tag_clear(&mapping->page_tree, radix_tree_tag_clear(&mapping->page_tree,
page_index(page), page_index(page),
PAGECACHE_TAG_WRITEBACK); PAGECACHE_TAG_WRITEBACK);
if (bdi_cap_writeback_dirty(bdi))
__dec_bdi_stat(bdi, BDI_WRITEBACK);
}
write_unlock_irqrestore(&mapping->tree_lock, flags); write_unlock_irqrestore(&mapping->tree_lock, flags);
} else { } else {
ret = TestClearPageWriteback(page); ret = TestClearPageWriteback(page);
...@@ -1002,14 +1006,18 @@ int test_set_page_writeback(struct page *page) ...@@ -1002,14 +1006,18 @@ int test_set_page_writeback(struct page *page)
int ret; int ret;
if (mapping) { if (mapping) {
struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags; unsigned long flags;
write_lock_irqsave(&mapping->tree_lock, flags); write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestSetPageWriteback(page); ret = TestSetPageWriteback(page);
if (!ret) if (!ret) {
radix_tree_tag_set(&mapping->page_tree, radix_tree_tag_set(&mapping->page_tree,
page_index(page), page_index(page),
PAGECACHE_TAG_WRITEBACK); PAGECACHE_TAG_WRITEBACK);
if (bdi_cap_writeback_dirty(bdi))
__inc_bdi_stat(bdi, BDI_WRITEBACK);
}
if (!PageDirty(page)) if (!PageDirty(page))
radix_tree_tag_clear(&mapping->page_tree, radix_tree_tag_clear(&mapping->page_tree,
page_index(page), page_index(page),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment