diff options
author | Andrew Morton <akpm@osdl.org> | 2006-12-10 05:19:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 12:55:41 -0500 |
commit | 55e829af06681e5d731c03ba04febbd1c76ca293 (patch) | |
tree | 4304030be250d913f56696ffda8ae660fb17b110 | |
parent | 8c08540f8755c451d8b96ea14cfe796bc3cd712d (diff) |
[PATCH] io-accounting: write accounting
Accounting writes is fairly simple: whenever a process flips a page from clean
to dirty, we accuse it of having caused a write to underlying storage of
PAGE_CACHE_SIZE bytes.
This may overestimate the amount of writing: the page-dirtying may cause only
one buffer_head's worth of writeout. Fixing that is possible, but probably a
bit messy and isn't obviously important.
Cc: Jay Lan <jlan@sgi.com>
Cc: Shailabh Nagar <nagar@watson.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Chris Sturtivant <csturtiv@sgi.com>
Cc: Tony Ernst <tee@sgi.com>
Cc: Guillaume Thouvenin <guillaume.thouvenin@bull.net>
Cc: David Wright <daw@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/buffer.c | 5 | ||||
-rw-r--r-- | mm/page-writeback.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 865570fe0d39..904d59d1eb8e 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/hash.h> | 35 | #include <linux/hash.h> |
36 | #include <linux/suspend.h> | 36 | #include <linux/suspend.h> |
37 | #include <linux/buffer_head.h> | 37 | #include <linux/buffer_head.h> |
38 | #include <linux/task_io_accounting_ops.h> | ||
38 | #include <linux/bio.h> | 39 | #include <linux/bio.h> |
39 | #include <linux/notifier.h> | 40 | #include <linux/notifier.h> |
40 | #include <linux/cpu.h> | 41 | #include <linux/cpu.h> |
@@ -729,8 +730,10 @@ int __set_page_dirty_buffers(struct page *page) | |||
729 | 730 | ||
730 | write_lock_irq(&mapping->tree_lock); | 731 | write_lock_irq(&mapping->tree_lock); |
731 | if (page->mapping) { /* Race with truncate? */ | 732 | if (page->mapping) { /* Race with truncate? */ |
732 | if (mapping_cap_account_dirty(mapping)) | 733 | if (mapping_cap_account_dirty(mapping)) { |
733 | __inc_zone_page_state(page, NR_FILE_DIRTY); | 734 | __inc_zone_page_state(page, NR_FILE_DIRTY); |
735 | task_io_account_write(PAGE_CACHE_SIZE); | ||
736 | } | ||
734 | radix_tree_tag_set(&mapping->page_tree, | 737 | radix_tree_tag_set(&mapping->page_tree, |
735 | page_index(page), PAGECACHE_TAG_DIRTY); | 738 | page_index(page), PAGECACHE_TAG_DIRTY); |
736 | } | 739 | } |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 59ffcdbde8b3..237107c1b084 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/writeback.h> | 21 | #include <linux/writeback.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/backing-dev.h> | 23 | #include <linux/backing-dev.h> |
24 | #include <linux/task_io_accounting_ops.h> | ||
24 | #include <linux/blkdev.h> | 25 | #include <linux/blkdev.h> |
25 | #include <linux/mpage.h> | 26 | #include <linux/mpage.h> |
26 | #include <linux/rmap.h> | 27 | #include <linux/rmap.h> |
@@ -768,8 +769,10 @@ int __set_page_dirty_nobuffers(struct page *page) | |||
768 | mapping2 = page_mapping(page); | 769 | mapping2 = page_mapping(page); |
769 | if (mapping2) { /* Race with truncate? */ | 770 | if (mapping2) { /* Race with truncate? */ |
770 | BUG_ON(mapping2 != mapping); | 771 | BUG_ON(mapping2 != mapping); |
771 | if (mapping_cap_account_dirty(mapping)) | 772 | if (mapping_cap_account_dirty(mapping)) { |
772 | __inc_zone_page_state(page, NR_FILE_DIRTY); | 773 | __inc_zone_page_state(page, NR_FILE_DIRTY); |
774 | task_io_account_write(PAGE_CACHE_SIZE); | ||
775 | } | ||
773 | radix_tree_tag_set(&mapping->page_tree, | 776 | radix_tree_tag_set(&mapping->page_tree, |
774 | page_index(page), PAGECACHE_TAG_DIRTY); | 777 | page_index(page), PAGECACHE_TAG_DIRTY); |
775 | } | 778 | } |