Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[jlayton/linux.git] / mm / shmem.c
index d3e5c6fc313ce94720c0f865859f71591d51cbe7..f484c276e994923a5c05577b42d5a9dcc58ae7cc 100644 (file)
@@ -1132,7 +1132,7 @@ repeat:
                        goto decused;
                }
 
-               SetPageSwapBacked(page);
+               __SetPageSwapBacked(page);
                __set_page_locked(page);
                error = mem_cgroup_charge_file(page, current->mm,
                                                gfp & GFP_RECLAIM_MASK);
@@ -1372,9 +1372,13 @@ shmem_write_begin(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned flags,
                        struct page **pagep, void **fsdata)
 {
+       int ret;
        struct inode *inode = mapping->host;
        pgoff_t index = pos >> PAGE_CACHE_SHIFT;
-       return shmem_getpage(inode, index, pagep, SGP_WRITE, NULL);
+       ret = shmem_getpage(inode, index, pagep, SGP_WRITE, NULL);
+       if (ret == 0 && *pagep)
+               init_page_accessed(*pagep);
+       return ret;
 }
 
 static int
@@ -2623,7 +2627,7 @@ static const struct file_operations shmem_file_operations = {
        .write_iter     = generic_file_write_iter,
        .fsync          = noop_fsync,
        .splice_read    = shmem_file_splice_read,
-       .splice_write   = generic_file_splice_write,
+       .splice_write   = iter_file_splice_write,
        .fallocate      = shmem_fallocate,
 #endif
 };