aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2017-02-24 17:56:41 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-24 20:46:54 -0500
commit11bac80004499ea59f361ef2a5516c84b6eab675 (patch)
treeb971df98b3fa9d4e62b8f4f7b5ec950181df4daa /mm/filemap.c
parent374ad05ab64d696303cec5cc8ec3a65d457b7b1c (diff)
mm, fs: reduce fault, page_mkwrite, and pfn_mkwrite to take only vmf
->fault(), ->page_mkwrite(), and ->pfn_mkwrite() calls do not need to take a vma and vmf parameter when the vma already resides in vmf. Remove the vma parameter to simplify things. [arnd@arndb.de: fix ARM build] Link: http://lkml.kernel.org/r/20170125223558.1451224-1-arnd@arndb.de Link: http://lkml.kernel.org/r/148521301778.19116.10840599906674778980.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Darrick J. Wong <darrick.wong@oracle.com> Cc: Matthew Wilcox <mawilcox@microsoft.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Jan Kara <jack@suse.com> Cc: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 416d563468a3..2ba46f410c7c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2169,7 +2169,6 @@ static void do_async_mmap_readahead(struct vm_area_struct *vma,
2169 2169
2170/** 2170/**
2171 * filemap_fault - read in file data for page fault handling 2171 * filemap_fault - read in file data for page fault handling
2172 * @vma: vma in which the fault was taken
2173 * @vmf: struct vm_fault containing details of the fault 2172 * @vmf: struct vm_fault containing details of the fault
2174 * 2173 *
2175 * filemap_fault() is invoked via the vma operations vector for a 2174 * filemap_fault() is invoked via the vma operations vector for a
@@ -2191,10 +2190,10 @@ static void do_async_mmap_readahead(struct vm_area_struct *vma,
2191 * 2190 *
2192 * We never return with VM_FAULT_RETRY and a bit from VM_FAULT_ERROR set. 2191 * We never return with VM_FAULT_RETRY and a bit from VM_FAULT_ERROR set.
2193 */ 2192 */
2194int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 2193int filemap_fault(struct vm_fault *vmf)
2195{ 2194{
2196 int error; 2195 int error;
2197 struct file *file = vma->vm_file; 2196 struct file *file = vmf->vma->vm_file;
2198 struct address_space *mapping = file->f_mapping; 2197 struct address_space *mapping = file->f_mapping;
2199 struct file_ra_state *ra = &file->f_ra; 2198 struct file_ra_state *ra = &file->f_ra;
2200 struct inode *inode = mapping->host; 2199 struct inode *inode = mapping->host;
@@ -2216,12 +2215,12 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
2216 * We found the page, so try async readahead before 2215 * We found the page, so try async readahead before
2217 * waiting for the lock. 2216 * waiting for the lock.
2218 */ 2217 */
2219 do_async_mmap_readahead(vma, ra, file, page, offset); 2218 do_async_mmap_readahead(vmf->vma, ra, file, page, offset);
2220 } else if (!page) { 2219 } else if (!page) {
2221 /* No page in the page cache at all */ 2220 /* No page in the page cache at all */
2222 do_sync_mmap_readahead(vma, ra, file, offset); 2221 do_sync_mmap_readahead(vmf->vma, ra, file, offset);
2223 count_vm_event(PGMAJFAULT); 2222 count_vm_event(PGMAJFAULT);
2224 mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT); 2223 mem_cgroup_count_vm_event(vmf->vma->vm_mm, PGMAJFAULT);
2225 ret = VM_FAULT_MAJOR; 2224 ret = VM_FAULT_MAJOR;
2226retry_find: 2225retry_find:
2227 page = find_get_page(mapping, offset); 2226 page = find_get_page(mapping, offset);
@@ -2229,7 +2228,7 @@ retry_find:
2229 goto no_cached_page; 2228 goto no_cached_page;
2230 } 2229 }
2231 2230
2232 if (!lock_page_or_retry(page, vma->vm_mm, vmf->flags)) { 2231 if (!lock_page_or_retry(page, vmf->vma->vm_mm, vmf->flags)) {
2233 put_page(page); 2232 put_page(page);
2234 return ret | VM_FAULT_RETRY; 2233 return ret | VM_FAULT_RETRY;
2235 } 2234 }
@@ -2396,14 +2395,14 @@ next:
2396} 2395}
2397EXPORT_SYMBOL(filemap_map_pages); 2396EXPORT_SYMBOL(filemap_map_pages);
2398 2397
2399int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) 2398int filemap_page_mkwrite(struct vm_fault *vmf)
2400{ 2399{
2401 struct page *page = vmf->page; 2400 struct page *page = vmf->page;
2402 struct inode *inode = file_inode(vma->vm_file); 2401 struct inode *inode = file_inode(vmf->vma->vm_file);
2403 int ret = VM_FAULT_LOCKED; 2402 int ret = VM_FAULT_LOCKED;
2404 2403
2405 sb_start_pagefault(inode->i_sb); 2404 sb_start_pagefault(inode->i_sb);
2406 file_update_time(vma->vm_file); 2405 file_update_time(vmf->vma->vm_file);
2407 lock_page(page); 2406 lock_page(page);
2408 if (page->mapping != inode->i_mapping) { 2407 if (page->mapping != inode->i_mapping) {
2409 unlock_page(page); 2408 unlock_page(page);