diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_file.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 24fa3b101b93..f1ce4323f56e 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -57,7 +57,9 @@ | |||
57 | #include <linux/smp_lock.h> | 57 | #include <linux/smp_lock.h> |
58 | 58 | ||
59 | static struct vm_operations_struct linvfs_file_vm_ops; | 59 | static struct vm_operations_struct linvfs_file_vm_ops; |
60 | 60 | #ifdef CONFIG_XFS_DMAPI | |
61 | static struct vm_operations_struct linvfs_dmapi_file_vm_ops; | ||
62 | #endif | ||
61 | 63 | ||
62 | STATIC inline ssize_t | 64 | STATIC inline ssize_t |
63 | __linvfs_read( | 65 | __linvfs_read( |
@@ -388,6 +390,14 @@ done: | |||
388 | return -error; | 390 | return -error; |
389 | } | 391 | } |
390 | 392 | ||
393 | #ifdef CONFIG_XFS_DMAPI | ||
394 | STATIC void | ||
395 | linvfs_mmap_close( | ||
396 | struct vm_area_struct *vma) | ||
397 | { | ||
398 | xfs_dm_mm_put(vma); | ||
399 | } | ||
400 | #endif /* CONFIG_XFS_DMAPI */ | ||
391 | 401 | ||
392 | STATIC int | 402 | STATIC int |
393 | linvfs_file_mmap( | 403 | linvfs_file_mmap( |
@@ -399,16 +409,19 @@ linvfs_file_mmap( | |||
399 | vattr_t va = { .va_mask = XFS_AT_UPDATIME }; | 409 | vattr_t va = { .va_mask = XFS_AT_UPDATIME }; |
400 | int error; | 410 | int error; |
401 | 411 | ||
412 | vma->vm_ops = &linvfs_file_vm_ops; | ||
413 | |||
402 | if (vp->v_vfsp->vfs_flag & VFS_DMI) { | 414 | if (vp->v_vfsp->vfs_flag & VFS_DMI) { |
403 | xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); | 415 | xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); |
404 | 416 | ||
405 | error = -XFS_SEND_MMAP(mp, vma, 0); | 417 | error = -XFS_SEND_MMAP(mp, vma, 0); |
406 | if (error) | 418 | if (error) |
407 | return error; | 419 | return error; |
420 | #ifdef CONFIG_XFS_DMAPI | ||
421 | vma->vm_ops = &linvfs_dmapi_file_vm_ops; | ||
422 | #endif | ||
408 | } | 423 | } |
409 | 424 | ||
410 | vma->vm_ops = &linvfs_file_vm_ops; | ||
411 | |||
412 | VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error); | 425 | VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error); |
413 | if (!error) | 426 | if (!error) |
414 | vn_revalidate(vp); /* update Linux inode flags */ | 427 | vn_revalidate(vp); /* update Linux inode flags */ |
@@ -609,7 +622,15 @@ struct file_operations linvfs_dir_operations = { | |||
609 | static struct vm_operations_struct linvfs_file_vm_ops = { | 622 | static struct vm_operations_struct linvfs_file_vm_ops = { |
610 | .nopage = filemap_nopage, | 623 | .nopage = filemap_nopage, |
611 | .populate = filemap_populate, | 624 | .populate = filemap_populate, |
625 | }; | ||
626 | |||
627 | #ifdef CONFIG_XFS_DMAPI | ||
628 | static struct vm_operations_struct linvfs_dmapi_file_vm_ops = { | ||
629 | .close = linvfs_mmap_close, | ||
630 | .nopage = filemap_nopage, | ||
631 | .populate = filemap_populate, | ||
612 | #ifdef HAVE_VMOP_MPROTECT | 632 | #ifdef HAVE_VMOP_MPROTECT |
613 | .mprotect = linvfs_mprotect, | 633 | .mprotect = linvfs_mprotect, |
614 | #endif | 634 | #endif |
615 | }; | 635 | }; |
636 | #endif /* CONFIG_XFS_DMAPI */ | ||