diff options
author | Chao Yu <chao@kernel.org> | 2022-07-12 23:26:43 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-07-30 20:17:06 -0700 |
commit | 0d5b9d8156396bbe1c982708b38ab9e188c45ec9 (patch) | |
tree | 1382ddb49e198f3c6b0d98d3840b336421939b86 /fs/f2fs/segment.c | |
parent | a8634ccf5d626506100bb753327e36e6c6b3df70 (diff) | |
download | linux-stable-0d5b9d8156396bbe1c982708b38ab9e188c45ec9.tar.gz linux-stable-0d5b9d8156396bbe1c982708b38ab9e188c45ec9.tar.bz2 linux-stable-0d5b9d8156396bbe1c982708b38ab9e188c45ec9.zip |
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/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index ce571c0d7126..12b0edc48f7b 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3433,7 +3433,8 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio) goto drop_bio; } - invalidate_mapping_pages(META_MAPPING(sbi), + if (fio->post_read) + invalidate_mapping_pages(META_MAPPING(sbi), fio->new_blkaddr, fio->new_blkaddr); stat_inc_inplace_blocks(fio->sbi); @@ -3616,10 +3617,16 @@ void f2fs_wait_on_block_writeback(struct inode *inode, block_t blkaddr) void f2fs_wait_on_block_writeback_range(struct inode *inode, block_t blkaddr, block_t len) { + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); block_t i; + if (!f2fs_post_read_required(inode)) + return; + for (i = 0; i < len; i++) f2fs_wait_on_block_writeback(inode, blkaddr + i); + + invalidate_mapping_pages(META_MAPPING(sbi), blkaddr, blkaddr + len - 1); } static int read_compacted_summaries(struct f2fs_sb_info *sbi) |