Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0f930a5 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

BACKPORT: f2fs: relocate inline conversion from mmap() to mkwrite()



If there is page fault only for read case on inline inode, we don't need
to convert inline inode, instead, let's do conversion for write case.

Bug: 208371174
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 58c3b33eb9f1)
Change-Id: I68168bc08a77d8d8f039189d44d23f83a7eda1f5
parent 4f4602b7
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -68,6 +68,10 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
		goto err;
	}

	err = f2fs_convert_inline_inode(inode);
	if (err)
		goto err;

#ifdef CONFIG_F2FS_FS_COMPRESSION
	if (f2fs_compressed_file(inode)) {
		int ret = f2fs_is_compressed_cluster(inode, page->index);
@@ -515,7 +519,6 @@ static loff_t f2fs_llseek(struct file *file, loff_t offset, int whence)
static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)
{
	struct inode *inode = file_inode(file);
	int err;

	if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
		return -EIO;
@@ -523,11 +526,6 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)
	if (!f2fs_is_compress_backend_ready(inode))
		return -EOPNOTSUPP;

	/* we don't need to use inline_data strictly */
	err = f2fs_convert_inline_inode(inode);
	if (err)
		return err;

	file_accessed(file);
	vma->vm_ops = &f2fs_file_vm_ops;
	set_inode_flag(inode, FI_MMAP_FILE);