public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: Clean up the loop outside of f2fs_invalidate_blocks()
@ 2025-01-13  1:47 Yi Sun
  2025-01-22  7:59 ` Chao Yu
  2025-01-22 21:20 ` [f2fs-dev] " patchwork-bot+f2fs
  0 siblings, 2 replies; 3+ messages in thread
From: Yi Sun @ 2025-01-13  1:47 UTC (permalink / raw)
  To: yi.sun, chao, jaegeuk
  Cc: Ke.Wang, linux-kernel, linux-f2fs-devel, Hao_hao.Wang,
	niuzhiguo84, zhiguo.niu

Now f2fs_invalidate_blocks() supports a continuous range of addresses,
so the for loop can be omitted.

Signed-off-by: Yi Sun <yi.sun@unisoc.com>
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
 fs/f2fs/file.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9980d17ef9f5..4baafad7a00c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -811,10 +811,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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: Clean up the loop outside of f2fs_invalidate_blocks()
  2025-01-13  1:47 [PATCH] f2fs: Clean up the loop outside of f2fs_invalidate_blocks() Yi Sun
@ 2025-01-22  7:59 ` Chao Yu
  2025-01-22 21:20 ` [f2fs-dev] " patchwork-bot+f2fs
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2025-01-22  7:59 UTC (permalink / raw)
  To: Yi Sun, jaegeuk
  Cc: chao, Ke.Wang, linux-kernel, linux-f2fs-devel, Hao_hao.Wang,
	niuzhiguo84, zhiguo.niu

On 1/13/25 09:47, Yi Sun wrote:
> Now f2fs_invalidate_blocks() supports a continuous range of addresses,
> so the for loop can be omitted.
> 
> Signed-off-by: Yi Sun <yi.sun@unisoc.com>
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>

Actually, this can be merged into "f2fs: add parameter @len to 
f2fs_invalidate_blocks()", but, anyway, I guess it's fine to merge it separately.

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

Thanks,

> ---
>   fs/f2fs/file.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 9980d17ef9f5..4baafad7a00c 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -811,10 +811,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);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: Clean up the loop outside of f2fs_invalidate_blocks()
  2025-01-13  1:47 [PATCH] f2fs: Clean up the loop outside of f2fs_invalidate_blocks() Yi Sun
  2025-01-22  7:59 ` Chao Yu
@ 2025-01-22 21:20 ` patchwork-bot+f2fs
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2025-01-22 21:20 UTC (permalink / raw)
  To: Yi Sun
  Cc: chao, jaegeuk, Ke.Wang, linux-kernel, linux-f2fs-devel,
	zhiguo.niu, Hao_hao.Wang

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Mon, 13 Jan 2025 09:47:02 +0800 you wrote:
> Now f2fs_invalidate_blocks() supports a continuous range of addresses,
> so the for loop can be omitted.
> 
> Signed-off-by: Yi Sun <yi.sun@unisoc.com>
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> ---
>  fs/f2fs/file.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Here is the summary with links:
  - [f2fs-dev] f2fs: Clean up the loop outside of f2fs_invalidate_blocks()
    https://git.kernel.org/jaegeuk/f2fs/c/6d4008dc4a8e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-22 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-13  1:47 [PATCH] f2fs: Clean up the loop outside of f2fs_invalidate_blocks() Yi Sun
2025-01-22  7:59 ` Chao Yu
2025-01-22 21:20 ` [f2fs-dev] " patchwork-bot+f2fs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox