This is a note to let you know that I've just added the patch titled f2fs: fix to update age extent correctly during truncation to the 6.2-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-fix-to-update-age-extent-correctly-during-trunc.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 189327de7132f9552739eb0148b51a1a393cbe8c Author: Chao Yu <chao@xxxxxxxxxx> Date: Tue Jan 31 22:47:00 2023 +0800 f2fs: fix to update age extent correctly during truncation [ Upstream commit 8c0ed062ce27f6b7f0a568cb241e2b4dd2d9e6a6 ] nr_free may be less than len, we should update age extent cache w/ range [fofs, len] rather than [fofs, nr_free]. Fixes: 71644dff4811 ("f2fs: add block_age-based extent cache") Signed-off-by: Chao Yu <chao@xxxxxxxxxx> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 63d468b1a9b82..cd1c6ed89d5ef 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -619,7 +619,7 @@ void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count) fofs = f2fs_start_bidx_of_node(ofs_of_node(dn->node_page), dn->inode) + ofs; f2fs_update_read_extent_cache_range(dn, fofs, 0, len); - f2fs_update_age_extent_cache_range(dn, fofs, nr_free); + f2fs_update_age_extent_cache_range(dn, fofs, len); dec_valid_block_count(sbi, dn->inode, nr_free); } dn->ofs_in_node = ofs;