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

Commit ee6d182f authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: remove syncing inode page in all the cases



This patch reduces to call them across the whole tree.
- sync_inode_page()
- update_inode_page()
- update_inode()
- f2fs_write_inode()

Instead, checkpoint will flush all the dirty inode metadata before syncing
node pages.
Note that, this is doable, since we call mark_inode_dirty_sync() for all
inode's field change which needs to update on-disk inode as well.

Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 0f18b462
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -343,8 +343,6 @@ int reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count)

	if (set_page_dirty(dn->node_page))
		dn->node_changed = true;

	sync_inode_page(dn);
	return 0;
}

@@ -562,11 +560,8 @@ struct page *get_new_data_page(struct inode *inode,
	}
got_it:
	if (new_i_size && i_size_read(inode) <
				((loff_t)(index + 1) << PAGE_SHIFT)) {
				((loff_t)(index + 1) << PAGE_SHIFT))
		f2fs_i_size_write(inode, ((loff_t)(index + 1) << PAGE_SHIFT));
		/* Only the directory inode sets new_i_size */
		set_inode_flag(inode, FI_UPDATE_DIR);
	}
	return page;
}

@@ -787,8 +782,6 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
	else if (dn.ofs_in_node < end_offset)
		goto next_block;

	if (allocated)
		sync_inode_page(&dn);
	f2fs_put_dnode(&dn);

	if (create) {
@@ -799,8 +792,6 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
	goto next_dnode;

sync_out:
	if (allocated)
		sync_inode_page(&dn);
	f2fs_put_dnode(&dn);
unlock_out:
	if (create) {
+3 −21
Original line number Diff line number Diff line
@@ -454,19 +454,15 @@ void update_parent_metadata(struct inode *dir, struct inode *inode,
						unsigned int current_depth)
{
	if (inode && is_inode_flag_set(inode, FI_NEW_INODE)) {
		if (S_ISDIR(inode->i_mode)) {
		if (S_ISDIR(inode->i_mode))
			f2fs_i_links_write(dir, true);
			set_inode_flag(dir, FI_UPDATE_DIR);
		}
		clear_inode_flag(inode, FI_NEW_INODE);
	}
	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
	mark_inode_dirty_sync(dir);

	if (F2FS_I(dir)->i_current_depth != current_depth) {
	if (F2FS_I(dir)->i_current_depth != current_depth)
		f2fs_i_depth_write(dir, current_depth);
		set_inode_flag(dir, FI_UPDATE_DIR);
	}

	if (inode && is_inode_flag_set(inode, FI_INC_LINK))
		clear_inode_flag(inode, FI_INC_LINK);
@@ -595,9 +591,7 @@ int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name,
	set_page_dirty(dentry_page);

	if (inode) {
		/* we don't need to mark_inode_dirty now */
		f2fs_i_pino_write(inode, dir->i_ino);
		update_inode(inode, page);
		f2fs_put_page(page, 1);
	}

@@ -606,10 +600,6 @@ int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name,
	if (inode)
		up_write(&F2FS_I(inode)->i_sem);

	if (is_inode_flag_set(dir, FI_UPDATE_DIR)) {
		update_inode_page(dir);
		clear_inode_flag(dir, FI_UPDATE_DIR);
	}
	kunmap(dentry_page);
	f2fs_put_page(dentry_page, 1);

@@ -656,8 +646,6 @@ int f2fs_do_tmpfile(struct inode *inode, struct inode *dir)
		err = PTR_ERR(page);
		goto fail;
	}
	/* we don't need to mark_inode_dirty now */
	update_inode(inode, page);
	f2fs_put_page(page, 1);

	clear_inode_flag(inode, FI_NEW_INODE);
@@ -673,13 +661,8 @@ void f2fs_drop_nlink(struct inode *dir, struct inode *inode, struct page *page)

	down_write(&F2FS_I(inode)->i_sem);

	if (S_ISDIR(inode->i_mode)) {
	if (S_ISDIR(inode->i_mode))
		f2fs_i_links_write(dir, false);
		if (page)
			update_inode(dir, page);
		else
			update_inode_page(dir);
	}
	inode->i_ctime = CURRENT_TIME;

	f2fs_i_links_write(inode, false);
@@ -688,7 +671,6 @@ void f2fs_drop_nlink(struct inode *dir, struct inode *inode, struct page *page)
		f2fs_i_size_write(inode, 0);
	}
	up_write(&F2FS_I(inode)->i_sem);
	update_inode_page(inode);

	if (inode->i_nlink == 0)
		add_orphan_inode(sbi, inode->i_ino);
+2 −5
Original line number Diff line number Diff line
@@ -689,9 +689,7 @@ void f2fs_update_extent_cache(struct dnode_of_data *dn)

	fofs = start_bidx_of_node(ofs_of_node(dn->node_page), dn->inode) +
								dn->ofs_in_node;

	if (f2fs_update_extent_tree_range(dn->inode, fofs, blkaddr, 1))
		sync_inode_page(dn);
	f2fs_update_extent_tree_range(dn->inode, fofs, blkaddr, 1);
}

void f2fs_update_extent_cache_range(struct dnode_of_data *dn,
@@ -701,8 +699,7 @@ void f2fs_update_extent_cache_range(struct dnode_of_data *dn,
	if (!f2fs_may_extent_tree(dn->inode))
		return;

	if (f2fs_update_extent_tree_range(dn->inode, fofs, blkaddr, len))
		sync_inode_page(dn);
	f2fs_update_extent_tree_range(dn->inode, fofs, blkaddr, len);
}

void init_extent_cache_info(struct f2fs_sb_info *sbi)
+0 −2
Original line number Diff line number Diff line
@@ -1521,7 +1521,6 @@ enum {
	FI_ACL_MODE,		/* indicate acl mode */
	FI_NO_ALLOC,		/* should not allocate any blocks */
	FI_FREE_NID,		/* free allocated nide */
	FI_UPDATE_DIR,		/* should update inode block for consistency */
	FI_NO_EXTENT,		/* not to use the extent cache */
	FI_INLINE_XATTR,	/* used for inline xattr */
	FI_INLINE_DATA,		/* used for inline data*/
@@ -1936,7 +1935,6 @@ struct page *new_node_page(struct dnode_of_data *, unsigned int, struct page *);
void ra_node_page(struct f2fs_sb_info *, nid_t);
struct page *get_node_page(struct f2fs_sb_info *, pgoff_t);
struct page *get_node_page_ra(struct page *, int);
void sync_inode_page(struct dnode_of_data *);
void move_node_page(struct page *, int);
int fsync_node_pages(struct f2fs_sb_info *, nid_t, struct writeback_control *,
								bool);
+3 −12
Original line number Diff line number Diff line
@@ -173,12 +173,8 @@ static void try_to_fix_pino(struct inode *inode)
			get_parent_ino(inode, &pino)) {
		f2fs_i_pino_write(inode, pino);
		file_got_pino(inode);
		up_write(&fi->i_sem);

		f2fs_write_inode(inode, NULL);
	} else {
		up_write(&fi->i_sem);
	}
	up_write(&fi->i_sem);
}

static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
@@ -499,7 +495,6 @@ int truncate_data_blocks_range(struct dnode_of_data *dn, int count)
							dn->inode) + ofs;
		f2fs_update_extent_cache_range(dn, fofs, 0, len);
		dec_valid_block_count(sbi, dn->inode, nr_free);
		sync_inode_page(dn);
	}
	dn->ofs_in_node = ofs;

@@ -1123,10 +1118,8 @@ static int f2fs_zero_range(struct inode *inode, loff_t offset, loff_t len,
	}

out:
	if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size) {
	if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size)
		f2fs_i_size_write(inode, new_size);
		update_inode_page(inode);
	}

	return ret;
}
@@ -1232,10 +1225,8 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
		new_size = ((loff_t)pg_end << PAGE_SHIFT) + off_end;
	}

	if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size) {
	if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size)
		f2fs_i_size_write(inode, new_size);
		update_inode_page(inode);
	}

	return ret;
}
Loading