From: Nick Piggin Callers should do the mark_page_accessed, as it is more flexible and in some contexts they don't want to be doing so, eg. dir-in-pagecache writes into buffer cache (although that's debateable, it wouldn't be possible if write_end() did the mark_page_accessed()). Subsequent patches contain fixes either to take mark_page_accessed out of their write_end implementation, or in the case of dir-in-pagecache filesystems, I had incorrectly added a mark_page_accessed where there was previously none (it looks like the logical place to mark the page accessed, but changing behaviour is obviously wrong for this bugfix series). Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton --- fs/buffer.c | 1 - mm/filemap.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff -puN fs/buffer.c~introduce-write_begin-write_end-aops-fix2 fs/buffer.c --- a/fs/buffer.c~introduce-write_begin-write_end-aops-fix2 +++ a/fs/buffer.c @@ -2052,7 +2052,6 @@ int generic_write_end(struct file *file, } unlock_page(page); - mark_page_accessed(page); page_cache_release(page); return copied; diff -puN mm/filemap.c~introduce-write_begin-write_end-aops-fix2 mm/filemap.c --- a/mm/filemap.c~introduce-write_begin-write_end-aops-fix2 +++ a/mm/filemap.c @@ -1913,6 +1913,7 @@ int pagecache_write_end(struct file *fil int ret; if (aops->write_end) { + mark_page_accessed(page); ret = aops->write_end(file, mapping, pos, len, copied, page, fsdata); } else { @@ -1922,6 +1923,7 @@ int pagecache_write_end(struct file *fil flush_dcache_page(page); ret = aops->commit_write(file, page, offset, offset+len); unlock_page(page); + mark_page_accessed(page); page_cache_release(page); BUG_ON(ret == AOP_TRUNCATED_PAGE); /* can't deal with */ _