summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2022-07-12 23:26:43 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2022-07-30 20:17:06 -0700
commit0d5b9d8156396bbe1c982708b38ab9e188c45ec9 (patch)
tree1382ddb49e198f3c6b0d98d3840b336421939b86 /fs/f2fs/data.c
parenta8634ccf5d626506100bb753327e36e6c6b3df70 (diff)
downloadlinux-0d5b9d8156396bbe1c982708b38ab9e188c45ec9.tar.bz2
f2fs: invalidate meta pages only for post_read required inode
After commit e3b49ea36802 ("f2fs: invalidate META_MAPPING before IPU/DIO write"), invalidate_mapping_pages() will be called to avoid race condition in between IPU/DIO and readahead for GC. However, readahead flow is only used for post_read required inode, so this patch adds check condition to avoids unnecessary page cache invalidating for non-post_read inode. Signed-off-by: Chao Yu <chao.yu@oppo.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index f2a272613477..de140afc42c1 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1463,12 +1463,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
*map->m_next_extent = pgofs + map->m_len;
/* for hardware encryption, but to avoid potential issue in future */
- if (flag == F2FS_GET_BLOCK_DIO) {
+ if (flag == F2FS_GET_BLOCK_DIO)
f2fs_wait_on_block_writeback_range(inode,
map->m_pblk, map->m_len);
- invalidate_mapping_pages(META_MAPPING(sbi),
- map->m_pblk, map->m_pblk + map->m_len - 1);
- }
if (map->m_multidev_dio) {
block_t blk_addr = map->m_pblk;
@@ -1684,8 +1681,6 @@ sync_out:
*/
f2fs_wait_on_block_writeback_range(inode,
map->m_pblk, map->m_len);
- invalidate_mapping_pages(META_MAPPING(sbi),
- map->m_pblk, map->m_pblk + map->m_len - 1);
if (map->m_multidev_dio) {
block_t blk_addr = map->m_pblk;
@@ -2733,6 +2728,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,
.submitted = false,
.compr_blocks = compr_blocks,
.need_lock = LOCK_RETRY,
+ .post_read = f2fs_post_read_required(inode),
.io_type = io_type,
.io_wbc = wbc,
.bio = bio,