linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: drop useless initializer and unneeded local variable
@ 2022-12-22  8:18 Yangtao Li via Linux-f2fs-devel
  2023-01-11 13:25 ` Chao Yu
  2023-01-30 23:00 ` patchwork-bot+f2fs
  0 siblings, 2 replies; 4+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2022-12-22  8:18 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: Yangtao Li, linux-kernel, linux-f2fs-devel

No need to initialize idx twice. BTW, remove the unnecessary cnt variable.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/f2fs/iostat.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
index 3166a8939ed4..335b055ffe7d 100644
--- a/fs/f2fs/iostat.c
+++ b/fs/f2fs/iostat.c
@@ -97,8 +97,7 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
 
 static inline void __record_iostat_latency(struct f2fs_sb_info *sbi)
 {
-	int io, idx = 0;
-	unsigned int cnt;
+	int io, idx;
 	struct f2fs_iostat_latency iostat_lat[MAX_IO_TYPE][NR_PAGE_TYPE];
 	struct iostat_lat_info *io_lat = sbi->iostat_io_lat;
 	unsigned long flags;
@@ -106,12 +105,11 @@ static inline void __record_iostat_latency(struct f2fs_sb_info *sbi)
 	spin_lock_irqsave(&sbi->iostat_lat_lock, flags);
 	for (idx = 0; idx < MAX_IO_TYPE; idx++) {
 		for (io = 0; io < NR_PAGE_TYPE; io++) {
-			cnt = io_lat->bio_cnt[idx][io];
 			iostat_lat[idx][io].peak_lat =
 			   jiffies_to_msecs(io_lat->peak_lat[idx][io]);
-			iostat_lat[idx][io].cnt = cnt;
-			iostat_lat[idx][io].avg_lat = cnt ?
-			   jiffies_to_msecs(io_lat->sum_lat[idx][io]) / cnt : 0;
+			iostat_lat[idx][io].cnt = io_lat->bio_cnt[idx][io];
+			iostat_lat[idx][io].avg_lat = iostat_lat[idx][io].cnt ?
+			   jiffies_to_msecs(io_lat->sum_lat[idx][io]) / iostat_lat[idx][io].cnt : 0;
 			io_lat->sum_lat[idx][io] = 0;
 			io_lat->peak_lat[idx][io] = 0;
 			io_lat->bio_cnt[idx][io] = 0;
-- 
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: drop useless initializer and unneeded local variable
  2022-12-22  8:18 [f2fs-dev] [PATCH] f2fs: drop useless initializer and unneeded local variable Yangtao Li via Linux-f2fs-devel
@ 2023-01-11 13:25 ` Chao Yu
  2023-01-12 14:46   ` Yangtao Li via Linux-f2fs-devel
  2023-01-30 23:00 ` patchwork-bot+f2fs
  1 sibling, 1 reply; 4+ messages in thread
From: Chao Yu @ 2023-01-11 13:25 UTC (permalink / raw)
  To: Yangtao Li, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

On 2022/12/22 16:18, Yangtao Li wrote:
> No need to initialize idx twice. BTW, remove the unnecessary cnt variable.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>   fs/f2fs/iostat.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
> index 3166a8939ed4..335b055ffe7d 100644
> --- a/fs/f2fs/iostat.c
> +++ b/fs/f2fs/iostat.c
> @@ -97,8 +97,7 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
>   
>   static inline void __record_iostat_latency(struct f2fs_sb_info *sbi)
>   {
> -	int io, idx = 0;
> -	unsigned int cnt;
> +	int io, idx;
>   	struct f2fs_iostat_latency iostat_lat[MAX_IO_TYPE][NR_PAGE_TYPE];
>   	struct iostat_lat_info *io_lat = sbi->iostat_io_lat;
>   	unsigned long flags;
> @@ -106,12 +105,11 @@ static inline void __record_iostat_latency(struct f2fs_sb_info *sbi)
>   	spin_lock_irqsave(&sbi->iostat_lat_lock, flags);
>   	for (idx = 0; idx < MAX_IO_TYPE; idx++) {
>   		for (io = 0; io < NR_PAGE_TYPE; io++) {
> -			cnt = io_lat->bio_cnt[idx][io];
>   			iostat_lat[idx][io].peak_lat =
>   			   jiffies_to_msecs(io_lat->peak_lat[idx][io]);
> -			iostat_lat[idx][io].cnt = cnt;
> -			iostat_lat[idx][io].avg_lat = cnt ?
> -			   jiffies_to_msecs(io_lat->sum_lat[idx][io]) / cnt : 0;
> +			iostat_lat[idx][io].cnt = io_lat->bio_cnt[idx][io];
> +			iostat_lat[idx][io].avg_lat = iostat_lat[idx][io].cnt ?
> +			   jiffies_to_msecs(io_lat->sum_lat[idx][io]) / iostat_lat[idx][io].cnt : 0;

exceed 80 column?

Thanks,

>   			io_lat->sum_lat[idx][io] = 0;
>   			io_lat->peak_lat[idx][io] = 0;
>   			io_lat->bio_cnt[idx][io] = 0;


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: drop useless initializer and unneeded local variable
  2023-01-11 13:25 ` Chao Yu
@ 2023-01-12 14:46   ` Yangtao Li via Linux-f2fs-devel
  0 siblings, 0 replies; 4+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2023-01-12 14:46 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-kernel, linux-f2fs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 530 bytes --]

> exceed 80 column?

I use the checkpatch.pl script to check that there are no errors.
Earlier, the default line length was 80 columns.
Commit bdc48fa11e46 (“checkpatch/coding-style: deprecate 80-column warning”) increased the limit to 100 columns. 

$ ./scripts/checkpatch.pl 0001-f2fs-drop-useless-initializer-and-unneeded-local-var.patch
total: 0 errors, 0 warnings, 24 lines checked

0001-f2fs-drop-useless-initializer-and-unneeded-local-var.patch has no obvious style problems and is ready for submission.

Thx,
Yangtao


[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 179 bytes --]

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: drop useless initializer and unneeded local variable
  2022-12-22  8:18 [f2fs-dev] [PATCH] f2fs: drop useless initializer and unneeded local variable Yangtao Li via Linux-f2fs-devel
  2023-01-11 13:25 ` Chao Yu
@ 2023-01-30 23:00 ` patchwork-bot+f2fs
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+f2fs @ 2023-01-30 23:00 UTC (permalink / raw)
  To: Yangtao Li; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

Hello:

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

On Thu, 22 Dec 2022 16:18:55 +0800 you wrote:
> No need to initialize idx twice. BTW, remove the unnecessary cnt variable.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  fs/f2fs/iostat.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

Here is the summary with links:
  - [f2fs-dev] f2fs: drop useless initializer and unneeded local variable
    https://git.kernel.org/jaegeuk/f2fs/c/c5f9db2548d0

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




_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2023-01-30 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-22  8:18 [f2fs-dev] [PATCH] f2fs: drop useless initializer and unneeded local variable Yangtao Li via Linux-f2fs-devel
2023-01-11 13:25 ` Chao Yu
2023-01-12 14:46   ` Yangtao Li via Linux-f2fs-devel
2023-01-30 23:00 ` 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;
as well as URLs for NNTP newsgroup(s).