diff options
author | Andrew Morton <akpm@osdl.org> | 2006-12-10 05:19:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 12:55:41 -0500 |
commit | e08748ce01e02f0ec154b141f392ccb9555333f4 (patch) | |
tree | 9fa9d9f8fb468997f7f6fbcb28e243724d1fdda6 | |
parent | 55e829af06681e5d731c03ba04febbd1c76ca293 (diff) |
[PATCH] io-accounting: write-cancel accounting
Account for the number of byte writes which this process caused to not happen
after all.
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 | 7 | ||||
-rw-r--r-- | mm/truncate.c | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 904d59d1eb8e..d1f1b54d3108 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -2853,8 +2853,13 @@ int try_to_free_buffers(struct page *page) | |||
2853 | * could encounter a non-uptodate page, which is unresolvable. | 2853 | * could encounter a non-uptodate page, which is unresolvable. |
2854 | * This only applies in the rare case where try_to_free_buffers | 2854 | * This only applies in the rare case where try_to_free_buffers |
2855 | * succeeds but the page is not freed. | 2855 | * succeeds but the page is not freed. |
2856 | * | ||
2857 | * Also, during truncate, discard_buffer will have marked all | ||
2858 | * the page's buffers clean. We discover that here and clean | ||
2859 | * the page also. | ||
2856 | */ | 2860 | */ |
2857 | clear_page_dirty(page); | 2861 | if (test_clear_page_dirty(page)) |
2862 | task_io_account_cancelled_write(PAGE_CACHE_SIZE); | ||
2858 | } | 2863 | } |
2859 | out: | 2864 | out: |
2860 | if (buffers_to_free) { | 2865 | if (buffers_to_free) { |
diff --git a/mm/truncate.c b/mm/truncate.c index e07b1e682c38..9bfb8e853860 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
15 | #include <linux/pagevec.h> | 15 | #include <linux/pagevec.h> |
16 | #include <linux/task_io_accounting_ops.h> | ||
16 | #include <linux/buffer_head.h> /* grr. try_to_release_page, | 17 | #include <linux/buffer_head.h> /* grr. try_to_release_page, |
17 | do_invalidatepage */ | 18 | do_invalidatepage */ |
18 | 19 | ||
@@ -69,7 +70,8 @@ truncate_complete_page(struct address_space *mapping, struct page *page) | |||
69 | if (PagePrivate(page)) | 70 | if (PagePrivate(page)) |
70 | do_invalidatepage(page, 0); | 71 | do_invalidatepage(page, 0); |
71 | 72 | ||
72 | clear_page_dirty(page); | 73 | if (test_clear_page_dirty(page)) |
74 | task_io_account_cancelled_write(PAGE_CACHE_SIZE); | ||
73 | ClearPageUptodate(page); | 75 | ClearPageUptodate(page); |
74 | ClearPageMappedToDisk(page); | 76 | ClearPageMappedToDisk(page); |
75 | remove_from_page_cache(page); | 77 | remove_from_page_cache(page); |