linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix compile warning
@ 2022-10-06 15:14 Chao Yu
  2022-10-07 19:53 ` Jaegeuk Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Yu @ 2022-10-06 15:14 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Chao Yu

fs/f2fs/super.c:3886:6: warning: no previous prototype for 'f2fs_record_stop_reason' [-Wmissing-prototypes]

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index fad333881ea2..2908d41ed462 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3884,7 +3884,7 @@ static void save_stop_reason(struct f2fs_sb_info *sbi, unsigned char reason)
 	spin_unlock(&sbi->error_lock);
 }
 
-void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
+static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
 {
 	struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
 	int err;
-- 
2.36.1


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

* Re: [PATCH] f2fs: fix compile warning
  2022-10-06 15:14 [PATCH] f2fs: fix compile warning Chao Yu
@ 2022-10-07 19:53 ` Jaegeuk Kim
  2022-10-08 11:08   ` Chao Yu
  0 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2022-10-07 19:53 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-kernel

Merged into the original patch.

On 10/06, Chao Yu wrote:
> fs/f2fs/super.c:3886:6: warning: no previous prototype for 'f2fs_record_stop_reason' [-Wmissing-prototypes]
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fs/f2fs/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index fad333881ea2..2908d41ed462 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -3884,7 +3884,7 @@ static void save_stop_reason(struct f2fs_sb_info *sbi, unsigned char reason)
>  	spin_unlock(&sbi->error_lock);
>  }
>  
> -void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
> +static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
>  {
>  	struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
>  	int err;
> -- 
> 2.36.1

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

* Re: [PATCH] f2fs: fix compile warning
  2022-10-07 19:53 ` Jaegeuk Kim
@ 2022-10-08 11:08   ` Chao Yu
  2022-10-10 17:22     ` Jaegeuk Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Yu @ 2022-10-08 11:08 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel

On 2022/10/8 3:53, Jaegeuk Kim wrote:
> Merged into the original patch.

Thanks, so it looks it's not too later to update commit id of original
patch since it's close to the end of merge window.

Thanks,

> 
> On 10/06, Chao Yu wrote:
>> fs/f2fs/super.c:3886:6: warning: no previous prototype for 'f2fs_record_stop_reason' [-Wmissing-prototypes]
>>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>>   fs/f2fs/super.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>> index fad333881ea2..2908d41ed462 100644
>> --- a/fs/f2fs/super.c
>> +++ b/fs/f2fs/super.c
>> @@ -3884,7 +3884,7 @@ static void save_stop_reason(struct f2fs_sb_info *sbi, unsigned char reason)
>>   	spin_unlock(&sbi->error_lock);
>>   }
>>   
>> -void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
>> +static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
>>   {
>>   	struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
>>   	int err;
>> -- 
>> 2.36.1

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

* Re: [PATCH] f2fs: fix compile warning
  2022-10-08 11:08   ` Chao Yu
@ 2022-10-10 17:22     ` Jaegeuk Kim
  0 siblings, 0 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2022-10-10 17:22 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-kernel

On 10/08, Chao Yu wrote:
> On 2022/10/8 3:53, Jaegeuk Kim wrote:
> > Merged into the original patch.
> 
> Thanks, so it looks it's not too later to update commit id of original
> patch since it's close to the end of merge window.

I put this in the next pull request.

> 
> Thanks,
> 
> > 
> > On 10/06, Chao Yu wrote:
> > > fs/f2fs/super.c:3886:6: warning: no previous prototype for 'f2fs_record_stop_reason' [-Wmissing-prototypes]
> > > 
> > > Signed-off-by: Chao Yu <chao@kernel.org>
> > > ---
> > >   fs/f2fs/super.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> > > index fad333881ea2..2908d41ed462 100644
> > > --- a/fs/f2fs/super.c
> > > +++ b/fs/f2fs/super.c
> > > @@ -3884,7 +3884,7 @@ static void save_stop_reason(struct f2fs_sb_info *sbi, unsigned char reason)
> > >   	spin_unlock(&sbi->error_lock);
> > >   }
> > > -void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
> > > +static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
> > >   {
> > >   	struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
> > >   	int err;
> > > -- 
> > > 2.36.1

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

* Re: [PATCH] f2fs: fix compile warning
  2021-03-02  8:44 Chao Yu
@ 2021-03-02  8:49 ` Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2021-03-02  8:49 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao

On 2021/3/2 16:44, Chao Yu wrote:
> node.c:2750:13: note: in expansion of macro ‘min’
>     nrpages = min(last_offset - i, BIO_MAX_PAGES);

Oh, after I rebase to last dev branch, compile warning is gone as
we changed to use bio_max_segs() rather than min().

Please ignore this patch.

Thanks,

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

* [PATCH] f2fs: fix compile warning
@ 2021-03-02  8:44 Chao Yu
  2021-03-02  8:49 ` Chao Yu
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Yu @ 2021-03-02  8:44 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu

node.c: In function ‘f2fs_restore_node_summary’:
./include/linux/minmax.h:18:28: warning: comparison of distinct pointer types lacks a cast
  (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                            ^
./include/linux/minmax.h:32:4: note: in expansion of macro ‘__typecheck’
   (__typecheck(x, y) && __no_side_effects(x, y))
    ^
./include/linux/minmax.h:42:24: note: in expansion of macro ‘__safe_cmp’
  __builtin_choose_expr(__safe_cmp(x, y), \
                        ^
./include/linux/minmax.h:51:19: note: in expansion of macro ‘__careful_cmp’
 #define min(x, y) __careful_cmp(x, y, <)
                   ^
node.c:2750:13: note: in expansion of macro ‘min’
   nrpages = min(last_offset - i, BIO_MAX_PAGES);

Use min_t() rather than min() to do type cast before comparing.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/node.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index a8a0fb890e8d..77f9ffaf9b8e 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2747,7 +2747,8 @@ int f2fs_restore_node_summary(struct f2fs_sb_info *sbi,
 	sum_entry = &sum->entries[0];
 
 	for (i = 0; i < last_offset; i += nrpages, addr += nrpages) {
-		nrpages = min(last_offset - i, BIO_MAX_PAGES);
+		nrpages = min_t(unsigned long, last_offset - i,
+						BIO_MAX_PAGES);
 
 		/* readahead node pages */
 		f2fs_ra_meta_pages(sbi, addr, nrpages, META_POR, true);
-- 
2.29.2


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

* [PATCH] f2fs: fix compile warning
@ 2020-08-10 10:38 Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2020-08-10 10:38 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu, kernel test robot

This patch fixes below compile warning reported by LKP
(kernel test robot)

cppcheck warnings: (new ones prefixed by >>)

>> fs/f2fs/file.c:761:9: warning: Identical condition 'err', second condition is always false [identicalConditionAfterEarlyExit]
    return err;
           ^
   fs/f2fs/file.c:753:6: note: first condition
    if (err)
        ^
   fs/f2fs/file.c:761:9: note: second condition
    return err;

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/file.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 8a422400e824..f16120352f0c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -753,11 +753,14 @@ int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock)
 		return err;
 
 #ifdef CONFIG_F2FS_FS_COMPRESSION
-	if (from != free_from)
+	if (from != free_from) {
 		err = f2fs_truncate_partial_cluster(inode, from, lock);
+		if (err)
+			return err;
+	}
 #endif
 
-	return err;
+	return 0;
 }
 
 int f2fs_truncate(struct inode *inode)
-- 
2.26.2


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

end of thread, other threads:[~2022-10-10 17:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 15:14 [PATCH] f2fs: fix compile warning Chao Yu
2022-10-07 19:53 ` Jaegeuk Kim
2022-10-08 11:08   ` Chao Yu
2022-10-10 17:22     ` Jaegeuk Kim
  -- strict thread matches above, loose matches on Subject: below --
2021-03-02  8:44 Chao Yu
2021-03-02  8:49 ` Chao Yu
2020-08-10 10:38 Chao Yu

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).