diff options
Diffstat (limited to 'fs/ext4/file.c')
| -rw-r--r-- | fs/ext4/file.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 4159be6366ab..430eb7978db4 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
| @@ -123,6 +123,23 @@ force_commit: | |||
| 123 | return ret; | 123 | return ret; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static struct vm_operations_struct ext4_file_vm_ops = { | ||
| 127 | .fault = filemap_fault, | ||
| 128 | .page_mkwrite = ext4_page_mkwrite, | ||
| 129 | }; | ||
| 130 | |||
| 131 | static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma) | ||
| 132 | { | ||
| 133 | struct address_space *mapping = file->f_mapping; | ||
| 134 | |||
| 135 | if (!mapping->a_ops->readpage) | ||
| 136 | return -ENOEXEC; | ||
| 137 | file_accessed(file); | ||
| 138 | vma->vm_ops = &ext4_file_vm_ops; | ||
| 139 | vma->vm_flags |= VM_CAN_NONLINEAR; | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 126 | const struct file_operations ext4_file_operations = { | 143 | const struct file_operations ext4_file_operations = { |
| 127 | .llseek = generic_file_llseek, | 144 | .llseek = generic_file_llseek, |
| 128 | .read = do_sync_read, | 145 | .read = do_sync_read, |
| @@ -133,7 +150,7 @@ const struct file_operations ext4_file_operations = { | |||
| 133 | #ifdef CONFIG_COMPAT | 150 | #ifdef CONFIG_COMPAT |
| 134 | .compat_ioctl = ext4_compat_ioctl, | 151 | .compat_ioctl = ext4_compat_ioctl, |
| 135 | #endif | 152 | #endif |
| 136 | .mmap = generic_file_mmap, | 153 | .mmap = ext4_file_mmap, |
| 137 | .open = generic_file_open, | 154 | .open = generic_file_open, |
| 138 | .release = ext4_release_file, | 155 | .release = ext4_release_file, |
| 139 | .fsync = ext4_sync_file, | 156 | .fsync = ext4_sync_file, |
| @@ -144,6 +161,7 @@ const struct file_operations ext4_file_operations = { | |||
| 144 | const struct inode_operations ext4_file_inode_operations = { | 161 | const struct inode_operations ext4_file_inode_operations = { |
| 145 | .truncate = ext4_truncate, | 162 | .truncate = ext4_truncate, |
| 146 | .setattr = ext4_setattr, | 163 | .setattr = ext4_setattr, |
| 164 | .getattr = ext4_getattr, | ||
| 147 | #ifdef CONFIG_EXT4DEV_FS_XATTR | 165 | #ifdef CONFIG_EXT4DEV_FS_XATTR |
| 148 | .setxattr = generic_setxattr, | 166 | .setxattr = generic_setxattr, |
| 149 | .getxattr = generic_getxattr, | 167 | .getxattr = generic_getxattr, |
