mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-21 21:26:35 +07:00
vfs: add/use account_page_dirtied()
Add a helper function account_page_dirtied(). Use that from two callsites. reiser4 adds a function which adds a third callsite. Signed-off-by: Edward Shishkin<edward.shishkin@gmail.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
bd2f6199cf
commit
e3a7cca1ef
@ -621,14 +621,7 @@ static void __set_page_dirty(struct page *page,
|
|||||||
spin_lock_irq(&mapping->tree_lock);
|
spin_lock_irq(&mapping->tree_lock);
|
||||||
if (page->mapping) { /* Race with truncate? */
|
if (page->mapping) { /* Race with truncate? */
|
||||||
WARN_ON_ONCE(warn && !PageUptodate(page));
|
WARN_ON_ONCE(warn && !PageUptodate(page));
|
||||||
|
account_page_dirtied(page, mapping);
|
||||||
if (mapping_cap_account_dirty(mapping)) {
|
|
||||||
__inc_zone_page_state(page, NR_FILE_DIRTY);
|
|
||||||
__inc_bdi_stat(mapping->backing_dev_info,
|
|
||||||
BDI_RECLAIMABLE);
|
|
||||||
task_dirty_inc(current);
|
|
||||||
task_io_account_write(PAGE_CACHE_SIZE);
|
|
||||||
}
|
|
||||||
radix_tree_tag_set(&mapping->page_tree,
|
radix_tree_tag_set(&mapping->page_tree,
|
||||||
page_index(page), PAGECACHE_TAG_DIRTY);
|
page_index(page), PAGECACHE_TAG_DIRTY);
|
||||||
}
|
}
|
||||||
|
@ -834,6 +834,7 @@ int __set_page_dirty_nobuffers(struct page *page);
|
|||||||
int __set_page_dirty_no_writeback(struct page *page);
|
int __set_page_dirty_no_writeback(struct page *page);
|
||||||
int redirty_page_for_writepage(struct writeback_control *wbc,
|
int redirty_page_for_writepage(struct writeback_control *wbc,
|
||||||
struct page *page);
|
struct page *page);
|
||||||
|
void account_page_dirtied(struct page *page, struct address_space *mapping);
|
||||||
int set_page_dirty(struct page *page);
|
int set_page_dirty(struct page *page);
|
||||||
int set_page_dirty_lock(struct page *page);
|
int set_page_dirty_lock(struct page *page);
|
||||||
int clear_page_dirty_for_io(struct page *page);
|
int clear_page_dirty_for_io(struct page *page);
|
||||||
|
@ -1197,6 +1197,20 @@ int __set_page_dirty_no_writeback(struct page *page)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper function for set_page_dirty family.
|
||||||
|
* NOTE: This relies on being atomic wrt interrupts.
|
||||||
|
*/
|
||||||
|
void account_page_dirtied(struct page *page, struct address_space *mapping)
|
||||||
|
{
|
||||||
|
if (mapping_cap_account_dirty(mapping)) {
|
||||||
|
__inc_zone_page_state(page, NR_FILE_DIRTY);
|
||||||
|
__inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
|
||||||
|
task_dirty_inc(current);
|
||||||
|
task_io_account_write(PAGE_CACHE_SIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For address_spaces which do not use buffers. Just tag the page as dirty in
|
* For address_spaces which do not use buffers. Just tag the page as dirty in
|
||||||
* its radix tree.
|
* its radix tree.
|
||||||
@ -1226,13 +1240,7 @@ int __set_page_dirty_nobuffers(struct page *page)
|
|||||||
if (mapping2) { /* Race with truncate? */
|
if (mapping2) { /* Race with truncate? */
|
||||||
BUG_ON(mapping2 != mapping);
|
BUG_ON(mapping2 != mapping);
|
||||||
WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
|
WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
|
||||||
if (mapping_cap_account_dirty(mapping)) {
|
account_page_dirtied(page, mapping);
|
||||||
__inc_zone_page_state(page, NR_FILE_DIRTY);
|
|
||||||
__inc_bdi_stat(mapping->backing_dev_info,
|
|
||||||
BDI_RECLAIMABLE);
|
|
||||||
task_dirty_inc(current);
|
|
||||||
task_io_account_write(PAGE_CACHE_SIZE);
|
|
||||||
}
|
|
||||||
radix_tree_tag_set(&mapping->page_tree,
|
radix_tree_tag_set(&mapping->page_tree,
|
||||||
page_index(page), PAGECACHE_TAG_DIRTY);
|
page_index(page), PAGECACHE_TAG_DIRTY);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user