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

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

f2fs: check its block allocation to avoid producing wrong dirty pages



If a page is cached but its block was deallocated, we don't need to make
the page dirty again by gc and truncate_partial_data_page.

In that case, it needs to check its block allocation all the time instead
of giving up-to-date page.

Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 2bca1e23
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -813,11 +813,19 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
		.rw = sync ? READ_SYNC : READA,
	};

	/*
	 * If sync is false, it needs to check its block allocation.
	 * This is need and triggered by two flows:
	 *   gc and truncate_partial_data_page.
	 */
	if (!sync)
		goto search;

	page = find_get_page(mapping, index);
	if (page && PageUptodate(page))
		return page;
	f2fs_put_page(page, 0);

search:
	if (f2fs_lookup_extent_cache(inode, index, &ei)) {
		dn.data_blkaddr = ei.blk + index - ei.fofs;
		goto got_it;