Skip to content

Commit

Permalink
mm: count writeback pages per BDI
Browse files Browse the repository at this point in the history
Count per BDI writeback pages.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Peter Zijlstra authored and Linus Torvalds committed Oct 17, 2007
1 parent c9e51e4 commit 69cb51d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/linux/backing-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ typedef int (congested_fn)(void *, int);

enum bdi_stat_item {
BDI_RECLAIMABLE,
BDI_WRITEBACK,
NR_BDI_STAT_ITEMS
};

Expand Down
12 changes: 10 additions & 2 deletions mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,14 +979,18 @@ int test_clear_page_writeback(struct page *page)
int ret;

if (mapping) {
struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags;

write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestClearPageWriteback(page);
if (ret)
if (ret) {
radix_tree_tag_clear(&mapping->page_tree,
page_index(page),
PAGECACHE_TAG_WRITEBACK);
if (bdi_cap_writeback_dirty(bdi))
__dec_bdi_stat(bdi, BDI_WRITEBACK);
}
write_unlock_irqrestore(&mapping->tree_lock, flags);
} else {
ret = TestClearPageWriteback(page);
Expand All @@ -1002,14 +1006,18 @@ int test_set_page_writeback(struct page *page)
int ret;

if (mapping) {
struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags;

write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestSetPageWriteback(page);
if (!ret)
if (!ret) {
radix_tree_tag_set(&mapping->page_tree,
page_index(page),
PAGECACHE_TAG_WRITEBACK);
if (bdi_cap_writeback_dirty(bdi))
__inc_bdi_stat(bdi, BDI_WRITEBACK);
}
if (!PageDirty(page))
radix_tree_tag_clear(&mapping->page_tree,
page_index(page),
Expand Down

0 comments on commit 69cb51d

Please sign in to comment.