diff options
author | Jan Kara <jack@suse.cz> | 2012-06-12 10:20:29 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-30 17:02:48 -0400 |
commit | 4fcf1c6205fcfc7a226a144ae4d83b7f5415cab8 (patch) | |
tree | e0a8ee8640c670123e09a8a041a3ed00c89a0d60 /mm/filemap.c | |
parent | 41c4d25f78c01ede13efee1f2e979f3f35dd26f6 (diff) |
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 <kamal@canonical.com>
Tested-by: Peter M. Petrakis <peter.petrakis@canonical.com>
Tested-by: Dann Frazier <dann.frazier@canonical.com>
Tested-by: Massimo Morana <massimo.morana@canonical.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index a4a5260b0279..51efee65c2cc 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1712,8 +1712,27 @@ page_not_uptodate: | |||
1712 | } | 1712 | } |
1713 | EXPORT_SYMBOL(filemap_fault); | 1713 | EXPORT_SYMBOL(filemap_fault); |
1714 | 1714 | ||
1715 | int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
1716 | { | ||
1717 | struct page *page = vmf->page; | ||
1718 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | ||
1719 | int ret = VM_FAULT_LOCKED; | ||
1720 | |||
1721 | file_update_time(vma->vm_file); | ||
1722 | lock_page(page); | ||
1723 | if (page->mapping != inode->i_mapping) { | ||
1724 | unlock_page(page); | ||
1725 | ret = VM_FAULT_NOPAGE; | ||
1726 | goto out; | ||
1727 | } | ||
1728 | out: | ||
1729 | return ret; | ||
1730 | } | ||
1731 | EXPORT_SYMBOL(filemap_page_mkwrite); | ||
1732 | |||
1715 | const struct vm_operations_struct generic_file_vm_ops = { | 1733 | const struct vm_operations_struct generic_file_vm_ops = { |
1716 | .fault = filemap_fault, | 1734 | .fault = filemap_fault, |
1735 | .page_mkwrite = filemap_page_mkwrite, | ||
1717 | }; | 1736 | }; |
1718 | 1737 | ||
1719 | /* This is used for a general mmap of a disk file */ | 1738 | /* This is used for a general mmap of a disk file */ |