diff options
Diffstat (limited to 'fs/ext4/file.c')
| -rw-r--r-- | fs/ext4/file.c | 16 | 
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 21df81347147..48908ce0c3ea 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -804,9 +804,10 @@ static const struct vm_operations_struct ext4_file_vm_ops = {  	.page_mkwrite   = ext4_page_mkwrite,  }; -static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma) +static int ext4_file_mmap_prepare(struct vm_area_desc *desc)  {  	int ret; +	struct file *file = desc->file;  	struct inode *inode = file->f_mapping->host;  	struct dax_device *dax_dev = EXT4_SB(inode->i_sb)->s_daxdev; @@ -821,15 +822,15 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)  	 * We don't support synchronous mappings for non-DAX files and  	 * for DAX files if underneath dax_device is not synchronous.  	 */ -	if (!daxdev_mapping_supported(vma, dax_dev)) +	if (!daxdev_mapping_supported(desc->vm_flags, file_inode(file), dax_dev))  		return -EOPNOTSUPP;  	file_accessed(file);  	if (IS_DAX(file_inode(file))) { -		vma->vm_ops = &ext4_dax_vm_ops; -		vm_flags_set(vma, VM_HUGEPAGE); +		desc->vm_ops = &ext4_dax_vm_ops; +		desc->vm_flags |= VM_HUGEPAGE;  	} else { -		vma->vm_ops = &ext4_file_vm_ops; +		desc->vm_ops = &ext4_file_vm_ops;  	}  	return 0;  } @@ -968,7 +969,7 @@ const struct file_operations ext4_file_operations = {  #ifdef CONFIG_COMPAT  	.compat_ioctl	= ext4_compat_ioctl,  #endif -	.mmap		= ext4_file_mmap, +	.mmap_prepare	= ext4_file_mmap_prepare,  	.open		= ext4_file_open,  	.release	= ext4_release_file,  	.fsync		= ext4_sync_file, @@ -977,7 +978,8 @@ const struct file_operations ext4_file_operations = {  	.splice_write	= iter_file_splice_write,  	.fallocate	= ext4_fallocate,  	.fop_flags	= FOP_MMAP_SYNC | FOP_BUFFER_RASYNC | -			  FOP_DIO_PARALLEL_WRITE, +			  FOP_DIO_PARALLEL_WRITE | +			  FOP_DONTCACHE,  };  const struct inode_operations ext4_file_inode_operations = {  | 
