diff mbox series

[f2fs-dev,2/2] f2fs: truncate pages if move file range success

Message ID 20230621094359.3827832-2-heyunlei@oppo.com (mailing list archive)
State Superseded
Headers show
Series [f2fs-dev,1/2,v2] f2fs: update mtime and ctime in move file range method | expand

Commit Message

Yunlei He June 21, 2023, 9:43 a.m. UTC
If move file range success, it should remove old data from
src and dst page cache.

Signed-off-by: Yunlei He <heyunlei@oppo.com>
---
 fs/f2fs/file.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Chao Yu June 21, 2023, 1:41 p.m. UTC | #1
On 2023/6/21 17:43, Yunlei He wrote:
> If move file range success, it should remove old data from
> src and dst page cache.
> 
> Signed-off-by: Yunlei He <heyunlei@oppo.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,
diff mbox series

Patch

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 4adcf62e2665..25ef36f2376a 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2897,6 +2897,9 @@  static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
 			f2fs_mark_inode_dirty_sync(dst, false);
 		}
 
+		truncate_pagecache_range(src, pos_in, pos_in + len - 1);
+		truncate_pagecache_range(dst, pos_out, pos_out + len - 1);
+
 		f2fs_update_time(F2FS_I_SB(src), REQ_TIME);
 	}