Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 19 Jul 2007 21:41:33 +0000 (14:41 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 19 Jul 2007 21:41:33 +0000 (14:41 -0700)
* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6:
  [XFS] Fix inode size update before data write in xfs_setattr
  [XFS] Allow punching holes to free space when at ENOSPC
  [XFS] Implement ->page_mkwrite in XFS.
  [FS] Implement block_page_mkwrite.

Manually fix up conflict with Nick's VM fault handling patches in
fs/xfs/linux-2.6/xfs_file.c

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1  2 
fs/xfs/linux-2.6/xfs_file.c

@@@ -212,18 -212,19 +212,18 @@@ xfs_file_fsync
  }
  
  #ifdef CONFIG_XFS_DMAPI
 -STATIC struct page *
 -xfs_vm_nopage(
 -      struct vm_area_struct   *area,
 -      unsigned long           address,
 -      int                     *type)
 +STATIC int
 +xfs_vm_fault(
 +      struct vm_area_struct   *vma,
 +      struct vm_fault *vmf)
  {
 -      struct inode    *inode = area->vm_file->f_path.dentry->d_inode;
 +      struct inode    *inode = vma->vm_file->f_path.dentry->d_inode;
        bhv_vnode_t     *vp = vn_from_inode(inode);
  
        ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
 -      if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), area, 0))
 -              return NULL;
 -      return filemap_nopage(area, address, type);
 +      if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), vma, 0))
 +              return VM_FAULT_SIGBUS;
 +      return filemap_fault(vma, vmf);
  }
  #endif /* CONFIG_XFS_DMAPI */
  
@@@ -309,7 -310,6 +309,7 @@@ xfs_file_mmap
        struct vm_area_struct *vma)
  {
        vma->vm_ops = &xfs_file_vm_ops;
 +      vma->vm_flags |= VM_CAN_NONLINEAR;
  
  #ifdef CONFIG_XFS_DMAPI
        if (vn_from_inode(filp->f_path.dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI)
@@@ -413,6 -413,20 +413,20 @@@ xfs_file_open_exec
  }
  #endif /* HAVE_FOP_OPEN_EXEC */
  
+ /*
+  * mmap()d file has taken write protection fault and is being made
+  * writable. We can set the page state up correctly for a writable
+  * page, which means we can do correct delalloc accounting (ENOSPC
+  * checking!) and unwritten extent mapping.
+  */
+ STATIC int
+ xfs_vm_page_mkwrite(
+       struct vm_area_struct   *vma,
+       struct page             *page)
+ {
+       return block_page_mkwrite(vma, page, xfs_get_blocks);
+ }
  const struct file_operations xfs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = do_sync_read,
@@@ -464,12 -478,16 +478,14 @@@ const struct file_operations xfs_dir_fi
  };
  
  static struct vm_operations_struct xfs_file_vm_ops = {
 -      .nopage         = filemap_nopage,
 -      .populate       = filemap_populate,
 +      .fault          = filemap_fault,
+       .page_mkwrite   = xfs_vm_page_mkwrite,
  };
  
  #ifdef CONFIG_XFS_DMAPI
  static struct vm_operations_struct xfs_dmapi_file_vm_ops = {
 -      .nopage         = xfs_vm_nopage,
 -      .populate       = filemap_populate,
 +      .fault          = xfs_vm_fault,
+       .page_mkwrite   = xfs_vm_page_mkwrite,
  #ifdef HAVE_VMOP_MPROTECT
        .mprotect       = xfs_vm_mprotect,
  #endif