27 #include <linux/types.h>
30 #include <linux/uio.h>
31 #include <linux/signal.h>
32 #include <linux/rbtree.h>
47 static int ocfs2_fault(
struct vm_area_struct *area,
struct vm_fault *vmf)
56 trace_ocfs2_fault(OCFS2_I(area->
vm_file->f_mapping->host)->ip_blkno,
57 area, vmf->page, vmf->pgoff);
61 static int __ocfs2_page_mkwrite(
struct file *
file,
struct buffer_head *di_bh,
64 int ret = VM_FAULT_NOPAGE;
70 struct page *locked_page =
NULL;
72 loff_t
size = i_size_read(inode);
90 (!PageUptodate(page)) ||
104 if (page->
index == last_index)
108 &fsdata, di_bh, page);
115 ret = VM_FAULT_SIGBUS;
120 ret = VM_FAULT_NOPAGE;
126 ret = VM_FAULT_LOCKED;
131 static int ocfs2_page_mkwrite(
struct vm_area_struct *vma,
struct vm_fault *vmf)
133 struct page *page = vmf->page;
134 struct inode *inode = vma->
vm_file->f_path.dentry->d_inode;
135 struct buffer_head *di_bh =
NULL;
139 sb_start_pagefault(inode->
i_sb);
160 ret = __ocfs2_page_mkwrite(vma->
vm_file, di_bh, page);
162 up_write(&OCFS2_I(inode)->ip_alloc_sem);
169 sb_end_pagefault(inode->
i_sb);
173 static const struct vm_operations_struct ocfs2_file_vm_ops = {
174 .fault = ocfs2_fault,
175 .page_mkwrite = ocfs2_page_mkwrite,
181 int ret = 0, lock_level = 0;
184 file->f_vfsmnt, &lock_level);
191 vma->
vm_ops = &ocfs2_file_vm_ops;