Commit 4f57dbc6 authored by David Chinner's avatar David Chinner Committed by Tim Shimmin

[XFS] Implement ->page_mkwrite in XFS.

Hook XFS up to ->page_mkwrite to ensure that we know about mmap pages
being written to. This allows use to do correct delayed allocation and
ENOSPC checking as well as remap unwritten extents so that they get
converted correctly during writeback. This is done via the generic
block_page_mkwrite code.

SGI-PV: 940392
SGI-Modid: xfs-linux-melb:xfs-kern:29149a
Signed-off-by: default avatarDavid Chinner <dgc@sgi.com>
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
parent 54171690
...@@ -413,6 +413,20 @@ xfs_file_open_exec( ...@@ -413,6 +413,20 @@ xfs_file_open_exec(
} }
#endif /* HAVE_FOP_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 = { const struct file_operations xfs_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.read = do_sync_read, .read = do_sync_read,
...@@ -466,12 +480,14 @@ const struct file_operations xfs_dir_file_operations = { ...@@ -466,12 +480,14 @@ const struct file_operations xfs_dir_file_operations = {
static struct vm_operations_struct xfs_file_vm_ops = { static struct vm_operations_struct xfs_file_vm_ops = {
.nopage = filemap_nopage, .nopage = filemap_nopage,
.populate = filemap_populate, .populate = filemap_populate,
.page_mkwrite = xfs_vm_page_mkwrite,
}; };
#ifdef CONFIG_XFS_DMAPI #ifdef CONFIG_XFS_DMAPI
static struct vm_operations_struct xfs_dmapi_file_vm_ops = { static struct vm_operations_struct xfs_dmapi_file_vm_ops = {
.nopage = xfs_vm_nopage, .nopage = xfs_vm_nopage,
.populate = filemap_populate, .populate = filemap_populate,
.page_mkwrite = xfs_vm_page_mkwrite,
#ifdef HAVE_VMOP_MPROTECT #ifdef HAVE_VMOP_MPROTECT
.mprotect = xfs_vm_mprotect, .mprotect = xfs_vm_mprotect,
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment