From: Yi Sun Date: Mon, 13 Jan 2025 01:47:02 +0000 (+0800) Subject: f2fs: Clean up the loop outside of f2fs_invalidate_blocks() X-Git-Tag: v6.14-rc1~63^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d4008dc4a8e0949afe1d9ff27c93fe68672ea06;p=thirdparty%2Fkernel%2Flinux.git f2fs: Clean up the loop outside of f2fs_invalidate_blocks() Now f2fs_invalidate_blocks() supports a continuous range of addresses, so the for loop can be omitted. Signed-off-by: Yi Sun Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 3e06fea9795c5..f92a9fba9991b 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -768,10 +768,8 @@ int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock) if (IS_DEVICE_ALIASING(inode)) { struct extent_tree *et = F2FS_I(inode)->extent_tree[EX_READ]; struct extent_info ei = et->largest; - unsigned int i; - for (i = 0; i < ei.len; i++) - f2fs_invalidate_blocks(sbi, ei.blk + i, 1); + f2fs_invalidate_blocks(sbi, ei.blk, ei.len); dec_valid_block_count(sbi, inode, ei.len); f2fs_update_time(sbi, REQ_TIME);