aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_file.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 8c43cd2e237a..0d4001eafd16 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -184,15 +184,6 @@ xfs_file_open(
184} 184}
185 185
186STATIC int 186STATIC int
187xfs_file_close(
188 struct file *filp,
189 fl_owner_t id)
190{
191 return -bhv_vop_close(vn_from_inode(filp->f_path.dentry->d_inode), 0,
192 file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL);
193}
194
195STATIC int
196xfs_file_release( 187xfs_file_release(
197 struct inode *inode, 188 struct inode *inode,
198 struct file *filp) 189 struct file *filp)
@@ -221,19 +212,18 @@ xfs_file_fsync(
221} 212}
222 213
223#ifdef CONFIG_XFS_DMAPI 214#ifdef CONFIG_XFS_DMAPI
224STATIC struct page * 215STATIC int
225xfs_vm_nopage( 216xfs_vm_fault(
226 struct vm_area_struct *area, 217 struct vm_area_struct *vma,
227 unsigned long address, 218 struct vm_fault *vmf)
228 int *type)
229{ 219{
230 struct inode *inode = area->vm_file->f_path.dentry->d_inode; 220 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
231 bhv_vnode_t *vp = vn_from_inode(inode); 221 bhv_vnode_t *vp = vn_from_inode(inode);
232 222
233 ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI); 223 ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
234 if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), area, 0)) 224 if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), vma, 0))
235 return NULL; 225 return VM_FAULT_SIGBUS;
236 return filemap_nopage(area, address, type); 226 return filemap_fault(vma, vmf);
237} 227}
238#endif /* CONFIG_XFS_DMAPI */ 228#endif /* CONFIG_XFS_DMAPI */
239 229
@@ -319,6 +309,7 @@ xfs_file_mmap(
319 struct vm_area_struct *vma) 309 struct vm_area_struct *vma)
320{ 310{
321 vma->vm_ops = &xfs_file_vm_ops; 311 vma->vm_ops = &xfs_file_vm_ops;
312 vma->vm_flags |= VM_CAN_NONLINEAR;
322 313
323#ifdef CONFIG_XFS_DMAPI 314#ifdef CONFIG_XFS_DMAPI
324 if (vn_from_inode(filp->f_path.dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI) 315 if (vn_from_inode(filp->f_path.dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI)
@@ -422,6 +413,20 @@ xfs_file_open_exec(
422} 413}
423#endif /* HAVE_FOP_OPEN_EXEC */ 414#endif /* HAVE_FOP_OPEN_EXEC */
424 415
416/*
417 * mmap()d file has taken write protection fault and is being made
418 * writable. We can set the page state up correctly for a writable
419 * page, which means we can do correct delalloc accounting (ENOSPC
420 * checking!) and unwritten extent mapping.
421 */
422STATIC int
423xfs_vm_page_mkwrite(
424 struct vm_area_struct *vma,
425 struct page *page)
426{
427 return block_page_mkwrite(vma, page, xfs_get_blocks);
428}
429
425const struct file_operations xfs_file_operations = { 430const struct file_operations xfs_file_operations = {
426 .llseek = generic_file_llseek, 431 .llseek = generic_file_llseek,
427 .read = do_sync_read, 432 .read = do_sync_read,
@@ -436,7 +441,6 @@ const struct file_operations xfs_file_operations = {
436#endif 441#endif
437 .mmap = xfs_file_mmap, 442 .mmap = xfs_file_mmap,
438 .open = xfs_file_open, 443 .open = xfs_file_open,
439 .flush = xfs_file_close,
440 .release = xfs_file_release, 444 .release = xfs_file_release,
441 .fsync = xfs_file_fsync, 445 .fsync = xfs_file_fsync,
442#ifdef HAVE_FOP_OPEN_EXEC 446#ifdef HAVE_FOP_OPEN_EXEC
@@ -458,7 +462,6 @@ const struct file_operations xfs_invis_file_operations = {
458#endif 462#endif
459 .mmap = xfs_file_mmap, 463 .mmap = xfs_file_mmap,
460 .open = xfs_file_open, 464 .open = xfs_file_open,
461 .flush = xfs_file_close,
462 .release = xfs_file_release, 465 .release = xfs_file_release,
463 .fsync = xfs_file_fsync, 466 .fsync = xfs_file_fsync,
464}; 467};
@@ -475,14 +478,14 @@ const struct file_operations xfs_dir_file_operations = {
475}; 478};
476 479
477static struct vm_operations_struct xfs_file_vm_ops = { 480static struct vm_operations_struct xfs_file_vm_ops = {
478 .nopage = filemap_nopage, 481 .fault = filemap_fault,
479 .populate = filemap_populate, 482 .page_mkwrite = xfs_vm_page_mkwrite,
480}; 483};
481 484
482#ifdef CONFIG_XFS_DMAPI 485#ifdef CONFIG_XFS_DMAPI
483static struct vm_operations_struct xfs_dmapi_file_vm_ops = { 486static struct vm_operations_struct xfs_dmapi_file_vm_ops = {
484 .nopage = xfs_vm_nopage, 487 .fault = xfs_vm_fault,
485 .populate = filemap_populate, 488 .page_mkwrite = xfs_vm_page_mkwrite,
486#ifdef HAVE_VMOP_MPROTECT 489#ifdef HAVE_VMOP_MPROTECT
487 .mprotect = xfs_vm_mprotect, 490 .mprotect = xfs_vm_mprotect,
488#endif 491#endif