aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2014-04-27 15:36:09 +0900
committerDaniel Phillips <daniel@tux3.org>2014-04-27 15:36:09 +0900
commit0ffba0cbd35ccb13e1961e006eb6190a44f2c5d6 (patch)
tree9a9e8590561675babe586f08c66bef011ef988b6
parent4365b0d9857a5808ce70191f703984ee58544358 (diff)
downloadlinux-tux3-0ffba0cbd35ccb13e1961e006eb6190a44f2c5d6.tar.gz
tux3: Support mmap write: Fix outside of i_size handling
If there are pages outside i_size, we have to clear dirty and remove those from I/O candidate. Now, tux3_clear_page_dirty_for_io() possibly dirty page again by current frontend delta. But, we should not dirty pages in backend, and we should simply discard pages outside i_size. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r--fs/tux3/buffer_writeback.c8
-rw-r--r--fs/tux3/buffer_writebacklib.c9
2 files changed, 13 insertions, 4 deletions
diff --git a/fs/tux3/buffer_writeback.c b/fs/tux3/buffer_writeback.c
index 55abea4df10beb..5d18ede8f25c5c 100644
--- a/fs/tux3/buffer_writeback.c
+++ b/fs/tux3/buffer_writeback.c
@@ -225,7 +225,13 @@ bufvec_prepare_and_lock_page(struct bufvec *bufvec, struct page *page)
* clear_dirty_for_io()
*/
if (!keep_page_dirty(bufvec, page)) {
- old_flag = tux3_clear_page_dirty_for_io(page);
+ /* FIXME: remove outside hack */
+ int outside;
+ offset = idata->i_size & (PAGE_CACHE_SIZE - 1);
+ last_index = idata->i_size >> PAGE_CACHE_SHIFT;
+ outside = offset && last_index == page->index;
+
+ old_flag = tux3_clear_page_dirty_for_io(page, outside);
assert(old_flag);
}
diff --git a/fs/tux3/buffer_writebacklib.c b/fs/tux3/buffer_writebacklib.c
index 917e80ba2915b8..56067ae7c0aa03 100644
--- a/fs/tux3/buffer_writebacklib.c
+++ b/fs/tux3/buffer_writebacklib.c
@@ -20,7 +20,7 @@
* This incoherency between the page's dirty flag and radix-tree tag is
* unfortunate, but it only exists while the page is locked.
*/
-static int tux3_clear_page_dirty_for_io(struct page *page)
+static int tux3_clear_page_dirty_for_io(struct page *page, int outside)
{
struct address_space *mapping = page->mapping;
@@ -53,8 +53,11 @@ static int tux3_clear_page_dirty_for_io(struct page *page)
* threads doing their things.
*/
/* If PageForked(), don't touch PTE and don't dirty */
- if (!PageForked(page) && page_mkclean(page))
- set_page_dirty(page);
+ if (!PageForked(page) && page_mkclean(page)) {
+ /* FIXME: we should not need to call this */
+ if (!outside)
+ set_page_dirty(page);
+ }
/*
* We carefully synchronise fault handlers against
* installing a dirty pte and marking the page dirty