All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][f2fs-next] f2fs: remove several redundant assignments
@ 2017-10-19 10:58 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-10-19 10:58 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

There are several assignments to variables that are redundant
as the values are never read when the variables are updated later
and so the redundant statements can be safely removed.

Cleans up clang warnings:
fs/f2fs/segment.c:923:19: warning: Value stored to 'p' during its initialization is never read
fs/f2fs/segment.c:2060:2: warning: Value stored to 'hint' is never read
fs/f2fs/segment.c:2353:2: warning: Value stored to 'start_block' is never read
fs/f2fs/segment.c:2354:2: warning: Value stored to 'end_block' is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/f2fs/segment.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index bfbcff8339c5..df7af294c1e0 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -920,7 +920,7 @@ static struct discard_cmd *__insert_discard_tree(struct f2fs_sb_info *sbi,
 				struct rb_node *insert_parent)
 {
 	struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
-	struct rb_node **p = &dcc->root.rb_node;
+	struct rb_node **p;
 	struct rb_node *parent = NULL;
 	struct discard_cmd *dc = NULL;
 
@@ -2057,7 +2057,6 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
 	}
 	secno = left_start;
 skip_left:
-	hint = secno;
 	segno = GET_SEG_FROM_SEC(sbi, secno);
 	zoneno = GET_ZONE_FROM_SEC(sbi, secno);
 
@@ -2350,9 +2349,6 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
 	end_segno = (end >= MAX_BLKADDR(sbi)) ? MAIN_SEGS(sbi) - 1 :
 						GET_SEGNO(sbi, end);
 
-	start_block = START_BLOCK(sbi, start_segno);
-	end_block = START_BLOCK(sbi, end_segno + 1);
-
 	cpc.reason = CP_DISCARD;
 	cpc.trim_minlen = max_t(__u64, 1, F2FS_BYTES_TO_BLK(range->minlen));
 
-- 
2.14.1

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

* [PATCH][f2fs-next] f2fs: remove several redundant assignments
@ 2017-10-19 10:58 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-10-19 10:58 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

There are several assignments to variables that are redundant
as the values are never read when the variables are updated later
and so the redundant statements can be safely removed.

Cleans up clang warnings:
fs/f2fs/segment.c:923:19: warning: Value stored to 'p' during its initialization is never read
fs/f2fs/segment.c:2060:2: warning: Value stored to 'hint' is never read
fs/f2fs/segment.c:2353:2: warning: Value stored to 'start_block' is never read
fs/f2fs/segment.c:2354:2: warning: Value stored to 'end_block' is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/f2fs/segment.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index bfbcff8339c5..df7af294c1e0 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -920,7 +920,7 @@ static struct discard_cmd *__insert_discard_tree(struct f2fs_sb_info *sbi,
 				struct rb_node *insert_parent)
 {
 	struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
-	struct rb_node **p = &dcc->root.rb_node;
+	struct rb_node **p;
 	struct rb_node *parent = NULL;
 	struct discard_cmd *dc = NULL;
 
@@ -2057,7 +2057,6 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
 	}
 	secno = left_start;
 skip_left:
-	hint = secno;
 	segno = GET_SEG_FROM_SEC(sbi, secno);
 	zoneno = GET_ZONE_FROM_SEC(sbi, secno);
 
@@ -2350,9 +2349,6 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
 	end_segno = (end >= MAX_BLKADDR(sbi)) ? MAIN_SEGS(sbi) - 1 :
 						GET_SEGNO(sbi, end);
 
-	start_block = START_BLOCK(sbi, start_segno);
-	end_block = START_BLOCK(sbi, end_segno + 1);
-
 	cpc.reason = CP_DISCARD;
 	cpc.trim_minlen = max_t(__u64, 1, F2FS_BYTES_TO_BLK(range->minlen));
 
-- 
2.14.1


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

* Re: [f2fs-dev] [PATCH][f2fs-next] f2fs: remove several redundant assignments
  2017-10-19 10:58 ` Colin King
@ 2017-10-22 14:57   ` Chao Yu
  -1 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2017-10-22 14:57 UTC (permalink / raw)
  To: Colin King, Jaegeuk Kim, Chao Yu, linux-f2fs-devel
  Cc: kernel-janitors, linux-kernel

On 2017/10/19 18:58, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There are several assignments to variables that are redundant
> as the values are never read when the variables are updated later
> and so the redundant statements can be safely removed.
> 
> Cleans up clang warnings:
> fs/f2fs/segment.c:923:19: warning: Value stored to 'p' during its initialization is never read
> fs/f2fs/segment.c:2060:2: warning: Value stored to 'hint' is never read
> fs/f2fs/segment.c:2353:2: warning: Value stored to 'start_block' is never read
> fs/f2fs/segment.c:2354:2: warning: Value stored to 'end_block' is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> ---
>  fs/f2fs/segment.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index bfbcff8339c5..df7af294c1e0 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -920,7 +920,7 @@ static struct discard_cmd *__insert_discard_tree(struct f2fs_sb_info *sbi,
>  				struct rb_node *insert_parent)
>  {
>  	struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
> -	struct rb_node **p = &dcc->root.rb_node;
> +	struct rb_node **p;
>  	struct rb_node *parent = NULL;
>  	struct discard_cmd *dc = NULL;
>  
> @@ -2057,7 +2057,6 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
>  	}
>  	secno = left_start;
>  skip_left:
> -	hint = secno;
>  	segno = GET_SEG_FROM_SEC(sbi, secno);
>  	zoneno = GET_ZONE_FROM_SEC(sbi, secno);
>  
> @@ -2350,9 +2349,6 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
>  	end_segno = (end >= MAX_BLKADDR(sbi)) ? MAIN_SEGS(sbi) - 1 :
>  						GET_SEGNO(sbi, end);
>  
> -	start_block = START_BLOCK(sbi, start_segno);
> -	end_block = START_BLOCK(sbi, end_segno + 1);
> -
>  	cpc.reason = CP_DISCARD;
>  	cpc.trim_minlen = max_t(__u64, 1, F2FS_BYTES_TO_BLK(range->minlen));
>  
> 

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

* Re: [f2fs-dev] [PATCH][f2fs-next] f2fs: remove several redundant assignments
@ 2017-10-22 14:57   ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2017-10-22 14:57 UTC (permalink / raw)
  To: Colin King, Jaegeuk Kim, Chao Yu, linux-f2fs-devel
  Cc: kernel-janitors, linux-kernel

On 2017/10/19 18:58, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There are several assignments to variables that are redundant
> as the values are never read when the variables are updated later
> and so the redundant statements can be safely removed.
> 
> Cleans up clang warnings:
> fs/f2fs/segment.c:923:19: warning: Value stored to 'p' during its initialization is never read
> fs/f2fs/segment.c:2060:2: warning: Value stored to 'hint' is never read
> fs/f2fs/segment.c:2353:2: warning: Value stored to 'start_block' is never read
> fs/f2fs/segment.c:2354:2: warning: Value stored to 'end_block' is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> ---
>  fs/f2fs/segment.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index bfbcff8339c5..df7af294c1e0 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -920,7 +920,7 @@ static struct discard_cmd *__insert_discard_tree(struct f2fs_sb_info *sbi,
>  				struct rb_node *insert_parent)
>  {
>  	struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
> -	struct rb_node **p = &dcc->root.rb_node;
> +	struct rb_node **p;
>  	struct rb_node *parent = NULL;
>  	struct discard_cmd *dc = NULL;
>  
> @@ -2057,7 +2057,6 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
>  	}
>  	secno = left_start;
>  skip_left:
> -	hint = secno;
>  	segno = GET_SEG_FROM_SEC(sbi, secno);
>  	zoneno = GET_ZONE_FROM_SEC(sbi, secno);
>  
> @@ -2350,9 +2349,6 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
>  	end_segno = (end >= MAX_BLKADDR(sbi)) ? MAIN_SEGS(sbi) - 1 :
>  						GET_SEGNO(sbi, end);
>  
> -	start_block = START_BLOCK(sbi, start_segno);
> -	end_block = START_BLOCK(sbi, end_segno + 1);
> -
>  	cpc.reason = CP_DISCARD;
>  	cpc.trim_minlen = max_t(__u64, 1, F2FS_BYTES_TO_BLK(range->minlen));
>  
> 

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

end of thread, other threads:[~2017-10-22 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 10:58 [PATCH][f2fs-next] f2fs: remove several redundant assignments Colin King
2017-10-19 10:58 ` Colin King
2017-10-22 14:57 ` [f2fs-dev] " Chao Yu
2017-10-22 14:57   ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.