mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mm: Make default vm_ops provide ->page_mkwrite handler
Make default vm_ops provide ->page_mkwrite handler. Currently it only updates file's modification times and gets locked page but later it will also handle filesystem freezing. BugLink: https://bugs.launchpad.net/bugs/897421 Tested-by: Kamal Mostafa <[email protected]> Tested-by: Peter M. Petrakis <[email protected]> Tested-by: Dann Frazier <[email protected]> Tested-by: Massimo Morana <[email protected]> Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
41c4d25f78
commit
4fcf1c6205
3 changed files with 21 additions and 0 deletions
19
mm/filemap.c
19
mm/filemap.c
|
|
@ -1712,8 +1712,27 @@ page_not_uptodate:
|
|||
}
|
||||
EXPORT_SYMBOL(filemap_fault);
|
||||
|
||||
int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||
{
|
||||
struct page *page = vmf->page;
|
||||
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
|
||||
int ret = VM_FAULT_LOCKED;
|
||||
|
||||
file_update_time(vma->vm_file);
|
||||
lock_page(page);
|
||||
if (page->mapping != inode->i_mapping) {
|
||||
unlock_page(page);
|
||||
ret = VM_FAULT_NOPAGE;
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(filemap_page_mkwrite);
|
||||
|
||||
const struct vm_operations_struct generic_file_vm_ops = {
|
||||
.fault = filemap_fault,
|
||||
.page_mkwrite = filemap_page_mkwrite,
|
||||
};
|
||||
|
||||
/* This is used for a general mmap of a disk file */
|
||||
|
|
|
|||
Loading…
Reference in a new issue