diff options
author | David Chinner <dgc@sgi.com> | 2007-07-19 02:28:17 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-07-19 05:51:21 -0400 |
commit | 4f57dbc6b5bae5a3978d429f45ac597ca7a3b8c6 (patch) | |
tree | 58abc5d0f67b9ceaa7913dda1d7b23fc308adbe6 | |
parent | 5417169026c3df151adf5a65eb061278b0a72e69 (diff) |
[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: David Chinner <dgc@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Tim Shimmin <tes@sgi.com>
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index cbcd40c8c2a0..b4c936485d11 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -413,6 +413,20 @@ xfs_file_open_exec( | |||
413 | } | 413 | } |
414 | #endif /* HAVE_FOP_OPEN_EXEC */ | 414 | #endif /* HAVE_FOP_OPEN_EXEC */ |
415 | 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 | */ | ||
422 | STATIC int | ||
423 | xfs_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 | |||
416 | const struct file_operations xfs_file_operations = { | 430 | const struct file_operations xfs_file_operations = { |
417 | .llseek = generic_file_llseek, | 431 | .llseek = generic_file_llseek, |
418 | .read = do_sync_read, | 432 | .read = do_sync_read, |
@@ -466,12 +480,14 @@ const struct file_operations xfs_dir_file_operations = { | |||
466 | static struct vm_operations_struct xfs_file_vm_ops = { | 480 | static struct vm_operations_struct xfs_file_vm_ops = { |
467 | .nopage = filemap_nopage, | 481 | .nopage = filemap_nopage, |
468 | .populate = filemap_populate, | 482 | .populate = filemap_populate, |
483 | .page_mkwrite = xfs_vm_page_mkwrite, | ||
469 | }; | 484 | }; |
470 | 485 | ||
471 | #ifdef CONFIG_XFS_DMAPI | 486 | #ifdef CONFIG_XFS_DMAPI |
472 | static struct vm_operations_struct xfs_dmapi_file_vm_ops = { | 487 | static struct vm_operations_struct xfs_dmapi_file_vm_ops = { |
473 | .nopage = xfs_vm_nopage, | 488 | .nopage = xfs_vm_nopage, |
474 | .populate = filemap_populate, | 489 | .populate = filemap_populate, |
490 | .page_mkwrite = xfs_vm_page_mkwrite, | ||
475 | #ifdef HAVE_VMOP_MPROTECT | 491 | #ifdef HAVE_VMOP_MPROTECT |
476 | .mprotect = xfs_vm_mprotect, | 492 | .mprotect = xfs_vm_mprotect, |
477 | #endif | 493 | #endif |