ocfs2-devel.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16
@ 2020-06-27  0:12 Junxiao Bi
  2020-06-29  1:47 ` Joseph Qi
  2020-07-03  8:45 ` Gang He
  0 siblings, 2 replies; 6+ messages in thread
From: Junxiao Bi @ 2020-06-27  0:12 UTC (permalink / raw)
  To: ocfs2-devel

Dan Carpenter reported the following static checker warning.

	fs/ocfs2/super.c:1269 ocfs2_parse_options() warn: '(-1)' 65535 can't fit into 32767 'mopt->slot'
	fs/ocfs2/suballoc.c:859 ocfs2_init_inode_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_inode_steal_slot'
	fs/ocfs2/suballoc.c:867 ocfs2_init_meta_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_meta_steal_slot'

That's because OCFS2_INVALID_SLOT is (u16)-1. Slot number in ocfs2 can be
never negative, so change s16 to u16.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
---
 fs/ocfs2/ocfs2.h    | 4 ++--
 fs/ocfs2/suballoc.c | 4 ++--
 fs/ocfs2/super.c    | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 2dd71d626196..7993d527edae 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -327,8 +327,8 @@ struct ocfs2_super
 	spinlock_t osb_lock;
 	u32 s_next_generation;
 	unsigned long osb_flags;
-	s16 s_inode_steal_slot;
-	s16 s_meta_steal_slot;
+	u16 s_inode_steal_slot;
+	u16 s_meta_steal_slot;
 	atomic_t s_num_inodes_stolen;
 	atomic_t s_num_meta_stolen;
 
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 45745cc3408a..8c8cf7f4eb34 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -879,9 +879,9 @@ static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type)
 {
 	spin_lock(&osb->osb_lock);
 	if (type == INODE_ALLOC_SYSTEM_INODE)
-		osb->s_inode_steal_slot = slot;
+		osb->s_inode_steal_slot = (u16)slot;
 	else if (type == EXTENT_ALLOC_SYSTEM_INODE)
-		osb->s_meta_steal_slot = slot;
+		osb->s_meta_steal_slot = (u16)slot;
 	spin_unlock(&osb->osb_lock);
 }
 
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 71ea9ce71a6b..1d91dd1e8711 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -78,7 +78,7 @@ struct mount_options
 	unsigned long	commit_interval;
 	unsigned long	mount_opt;
 	unsigned int	atime_quantum;
-	signed short	slot;
+	unsigned short	slot;
 	int		localalloc_opt;
 	unsigned int	resv_level;
 	int		dir_resv_level;
@@ -1349,7 +1349,7 @@ static int ocfs2_parse_options(struct super_block *sb,
 				goto bail;
 			}
 			if (option)
-				mopt->slot = (s16)option;
+				mopt->slot = (u16)option;
 			break;
 		case Opt_commit:
 			if (match_int(&args[0], &option)) {
-- 
2.20.1 (Apple Git-117)

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

* [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16
  2020-06-27  0:12 [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16 Junxiao Bi
@ 2020-06-29  1:47 ` Joseph Qi
  2020-07-03  8:45 ` Gang He
  1 sibling, 0 replies; 6+ messages in thread
From: Joseph Qi @ 2020-06-29  1:47 UTC (permalink / raw)
  To: ocfs2-devel



On 2020/6/27 08:12, Junxiao Bi wrote:
> Dan Carpenter reported the following static checker warning.
> 
> 	fs/ocfs2/super.c:1269 ocfs2_parse_options() warn: '(-1)' 65535 can't fit into 32767 'mopt->slot'
> 	fs/ocfs2/suballoc.c:859 ocfs2_init_inode_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_inode_steal_slot'
> 	fs/ocfs2/suballoc.c:867 ocfs2_init_meta_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_meta_steal_slot'
> 
> That's because OCFS2_INVALID_SLOT is (u16)-1. Slot number in ocfs2 can be
> never negative, so change s16 to u16.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/ocfs2.h    | 4 ++--
>  fs/ocfs2/suballoc.c | 4 ++--
>  fs/ocfs2/super.c    | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
> index 2dd71d626196..7993d527edae 100644
> --- a/fs/ocfs2/ocfs2.h
> +++ b/fs/ocfs2/ocfs2.h
> @@ -327,8 +327,8 @@ struct ocfs2_super
>  	spinlock_t osb_lock;
>  	u32 s_next_generation;
>  	unsigned long osb_flags;
> -	s16 s_inode_steal_slot;
> -	s16 s_meta_steal_slot;
> +	u16 s_inode_steal_slot;
> +	u16 s_meta_steal_slot;
>  	atomic_t s_num_inodes_stolen;
>  	atomic_t s_num_meta_stolen;
>  
> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
> index 45745cc3408a..8c8cf7f4eb34 100644
> --- a/fs/ocfs2/suballoc.c
> +++ b/fs/ocfs2/suballoc.c
> @@ -879,9 +879,9 @@ static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type)
>  {
>  	spin_lock(&osb->osb_lock);
>  	if (type == INODE_ALLOC_SYSTEM_INODE)
> -		osb->s_inode_steal_slot = slot;
> +		osb->s_inode_steal_slot = (u16)slot;
>  	else if (type == EXTENT_ALLOC_SYSTEM_INODE)
> -		osb->s_meta_steal_slot = slot;
> +		osb->s_meta_steal_slot = (u16)slot;
>  	spin_unlock(&osb->osb_lock);
>  }
>  
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index 71ea9ce71a6b..1d91dd1e8711 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -78,7 +78,7 @@ struct mount_options
>  	unsigned long	commit_interval;
>  	unsigned long	mount_opt;
>  	unsigned int	atime_quantum;
> -	signed short	slot;
> +	unsigned short	slot;
>  	int		localalloc_opt;
>  	unsigned int	resv_level;
>  	int		dir_resv_level;
> @@ -1349,7 +1349,7 @@ static int ocfs2_parse_options(struct super_block *sb,
>  				goto bail;
>  			}
>  			if (option)
> -				mopt->slot = (s16)option;
> +				mopt->slot = (u16)option;
>  			break;
>  		case Opt_commit:
>  			if (match_int(&args[0], &option)) {
> 

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

* [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16
  2020-06-27  0:12 [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16 Junxiao Bi
  2020-06-29  1:47 ` Joseph Qi
@ 2020-07-03  8:45 ` Gang He
  2020-07-03 12:11   ` Joseph Qi
  1 sibling, 1 reply; 6+ messages in thread
From: Gang He @ 2020-07-03  8:45 UTC (permalink / raw)
  To: ocfs2-devel



On 6/27/2020 8:12 AM, Junxiao Bi wrote:
> Dan Carpenter reported the following static checker warning.
> 
> 	fs/ocfs2/super.c:1269 ocfs2_parse_options() warn: '(-1)' 65535 can't fit into 32767 'mopt->slot'
> 	fs/ocfs2/suballoc.c:859 ocfs2_init_inode_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_inode_steal_slot'
> 	fs/ocfs2/suballoc.c:867 ocfs2_init_meta_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_meta_steal_slot'
> 
> That's because OCFS2_INVALID_SLOT is (u16)-1. Slot number in ocfs2 can be
> never negative, so change s16 to u16.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>

Reviewed-by: Gang He <ghe@suse.com>
Fixes: 9277f8334ffc ("ocfs2: fix value of OCFS2_INVALID_SLOT")

> ---
>   fs/ocfs2/ocfs2.h    | 4 ++--
>   fs/ocfs2/suballoc.c | 4 ++--
>   fs/ocfs2/super.c    | 4 ++--
>   3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
> index 2dd71d626196..7993d527edae 100644
> --- a/fs/ocfs2/ocfs2.h
> +++ b/fs/ocfs2/ocfs2.h
> @@ -327,8 +327,8 @@ struct ocfs2_super
>   	spinlock_t osb_lock;
>   	u32 s_next_generation;
>   	unsigned long osb_flags;
> -	s16 s_inode_steal_slot;
> -	s16 s_meta_steal_slot;
> +	u16 s_inode_steal_slot;
> +	u16 s_meta_steal_slot;
>   	atomic_t s_num_inodes_stolen;
>   	atomic_t s_num_meta_stolen;
>   
> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
> index 45745cc3408a..8c8cf7f4eb34 100644
> --- a/fs/ocfs2/suballoc.c
> +++ b/fs/ocfs2/suballoc.c
> @@ -879,9 +879,9 @@ static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type)
>   {
>   	spin_lock(&osb->osb_lock);
>   	if (type == INODE_ALLOC_SYSTEM_INODE)
> -		osb->s_inode_steal_slot = slot;
> +		osb->s_inode_steal_slot = (u16)slot;
>   	else if (type == EXTENT_ALLOC_SYSTEM_INODE)
> -		osb->s_meta_steal_slot = slot;
> +		osb->s_meta_steal_slot = (u16)slot;
>   	spin_unlock(&osb->osb_lock);
>   }
>   
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index 71ea9ce71a6b..1d91dd1e8711 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -78,7 +78,7 @@ struct mount_options
>   	unsigned long	commit_interval;
>   	unsigned long	mount_opt;
>   	unsigned int	atime_quantum;
> -	signed short	slot;
> +	unsigned short	slot;
>   	int		localalloc_opt;
>   	unsigned int	resv_level;
>   	int		dir_resv_level;
> @@ -1349,7 +1349,7 @@ static int ocfs2_parse_options(struct super_block *sb,
>   				goto bail;
>   			}
>   			if (option)
> -				mopt->slot = (s16)option;
> +				mopt->slot = (u16)option;
>   			break;
>   		case Opt_commit:
>   			if (match_int(&args[0], &option)) {
> 

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

* [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16
  2020-07-03  8:45 ` Gang He
@ 2020-07-03 12:11   ` Joseph Qi
  2020-08-03  6:43     ` Gang He
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Qi @ 2020-07-03 12:11 UTC (permalink / raw)
  To: ocfs2-devel



On 2020/7/3 16:45, Gang He wrote:
> 
> 
> On 6/27/2020 8:12 AM, Junxiao Bi wrote:
>> Dan Carpenter reported the following static checker warning.
>>
>> 	fs/ocfs2/super.c:1269 ocfs2_parse_options() warn: '(-1)' 65535 can't fit into 32767 'mopt->slot'
>> 	fs/ocfs2/suballoc.c:859 ocfs2_init_inode_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_inode_steal_slot'
>> 	fs/ocfs2/suballoc.c:867 ocfs2_init_meta_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_meta_steal_slot'
>>
>> That's because OCFS2_INVALID_SLOT is (u16)-1. Slot number in ocfs2 can be
>> never negative, so change s16 to u16.
>>
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
> 
> Reviewed-by: Gang He <ghe@suse.com>
> Fixes: 9277f8334ffc ("ocfs2: fix value of OCFS2_INVALID_SLOT")
> 

Add Cc tag as well.
Cc: <stable@vger.kernel.org>

>> ---
>>   fs/ocfs2/ocfs2.h    | 4 ++--
>>   fs/ocfs2/suballoc.c | 4 ++--
>>   fs/ocfs2/super.c    | 4 ++--
>>   3 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
>> index 2dd71d626196..7993d527edae 100644
>> --- a/fs/ocfs2/ocfs2.h
>> +++ b/fs/ocfs2/ocfs2.h
>> @@ -327,8 +327,8 @@ struct ocfs2_super
>>   	spinlock_t osb_lock;
>>   	u32 s_next_generation;
>>   	unsigned long osb_flags;
>> -	s16 s_inode_steal_slot;
>> -	s16 s_meta_steal_slot;
>> +	u16 s_inode_steal_slot;
>> +	u16 s_meta_steal_slot;
>>   	atomic_t s_num_inodes_stolen;
>>   	atomic_t s_num_meta_stolen;
>>   
>> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
>> index 45745cc3408a..8c8cf7f4eb34 100644
>> --- a/fs/ocfs2/suballoc.c
>> +++ b/fs/ocfs2/suballoc.c
>> @@ -879,9 +879,9 @@ static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type)
>>   {
>>   	spin_lock(&osb->osb_lock);
>>   	if (type == INODE_ALLOC_SYSTEM_INODE)
>> -		osb->s_inode_steal_slot = slot;
>> +		osb->s_inode_steal_slot = (u16)slot;
>>   	else if (type == EXTENT_ALLOC_SYSTEM_INODE)
>> -		osb->s_meta_steal_slot = slot;
>> +		osb->s_meta_steal_slot = (u16)slot;
>>   	spin_unlock(&osb->osb_lock);
>>   }
>>   
>> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
>> index 71ea9ce71a6b..1d91dd1e8711 100644
>> --- a/fs/ocfs2/super.c
>> +++ b/fs/ocfs2/super.c
>> @@ -78,7 +78,7 @@ struct mount_options
>>   	unsigned long	commit_interval;
>>   	unsigned long	mount_opt;
>>   	unsigned int	atime_quantum;
>> -	signed short	slot;
>> +	unsigned short	slot;
>>   	int		localalloc_opt;
>>   	unsigned int	resv_level;
>>   	int		dir_resv_level;
>> @@ -1349,7 +1349,7 @@ static int ocfs2_parse_options(struct super_block *sb,
>>   				goto bail;
>>   			}
>>   			if (option)
>> -				mopt->slot = (s16)option;
>> +				mopt->slot = (u16)option;
>>   			break;
>>   		case Opt_commit:
>>   			if (match_int(&args[0], &option)) {
>>
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel
> 

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

* [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16
  2020-07-03 12:11   ` Joseph Qi
@ 2020-08-03  6:43     ` Gang He
  2020-08-04  0:45       ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Gang He @ 2020-08-03  6:43 UTC (permalink / raw)
  To: ocfs2-devel

Hello Andrew,

Could you help to commit this patch to Linus git tree? since this patch 
will fix the latest patch (ocfs2: fix value of OCFS2_INVALID_SLOT).
So far, the current ocfs2 code under Linus git tree does NOT work.


Thanks
Gang

On 7/3/2020 8:11 PM, Joseph Qi wrote:
> 
> 
> On 2020/7/3 16:45, Gang He wrote:
>>
>>
>> On 6/27/2020 8:12 AM, Junxiao Bi wrote:
>>> Dan Carpenter reported the following static checker warning.
>>>
>>> 	fs/ocfs2/super.c:1269 ocfs2_parse_options() warn: '(-1)' 65535 can't fit into 32767 'mopt->slot'
>>> 	fs/ocfs2/suballoc.c:859 ocfs2_init_inode_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_inode_steal_slot'
>>> 	fs/ocfs2/suballoc.c:867 ocfs2_init_meta_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_meta_steal_slot'
>>>
>>> That's because OCFS2_INVALID_SLOT is (u16)-1. Slot number in ocfs2 can be
>>> never negative, so change s16 to u16.
>>>
>>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>> Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
>>
>> Reviewed-by: Gang He <ghe@suse.com>
>> Fixes: 9277f8334ffc ("ocfs2: fix value of OCFS2_INVALID_SLOT")
>>
> 
> Add Cc tag as well.
> Cc: <stable@vger.kernel.org>
> 
>>> ---
>>>    fs/ocfs2/ocfs2.h    | 4 ++--
>>>    fs/ocfs2/suballoc.c | 4 ++--
>>>    fs/ocfs2/super.c    | 4 ++--
>>>    3 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
>>> index 2dd71d626196..7993d527edae 100644
>>> --- a/fs/ocfs2/ocfs2.h
>>> +++ b/fs/ocfs2/ocfs2.h
>>> @@ -327,8 +327,8 @@ struct ocfs2_super
>>>    	spinlock_t osb_lock;
>>>    	u32 s_next_generation;
>>>    	unsigned long osb_flags;
>>> -	s16 s_inode_steal_slot;
>>> -	s16 s_meta_steal_slot;
>>> +	u16 s_inode_steal_slot;
>>> +	u16 s_meta_steal_slot;
>>>    	atomic_t s_num_inodes_stolen;
>>>    	atomic_t s_num_meta_stolen;
>>>    
>>> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
>>> index 45745cc3408a..8c8cf7f4eb34 100644
>>> --- a/fs/ocfs2/suballoc.c
>>> +++ b/fs/ocfs2/suballoc.c
>>> @@ -879,9 +879,9 @@ static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type)
>>>    {
>>>    	spin_lock(&osb->osb_lock);
>>>    	if (type == INODE_ALLOC_SYSTEM_INODE)
>>> -		osb->s_inode_steal_slot = slot;
>>> +		osb->s_inode_steal_slot = (u16)slot;
>>>    	else if (type == EXTENT_ALLOC_SYSTEM_INODE)
>>> -		osb->s_meta_steal_slot = slot;
>>> +		osb->s_meta_steal_slot = (u16)slot;
>>>    	spin_unlock(&osb->osb_lock);
>>>    }
>>>    
>>> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
>>> index 71ea9ce71a6b..1d91dd1e8711 100644
>>> --- a/fs/ocfs2/super.c
>>> +++ b/fs/ocfs2/super.c
>>> @@ -78,7 +78,7 @@ struct mount_options
>>>    	unsigned long	commit_interval;
>>>    	unsigned long	mount_opt;
>>>    	unsigned int	atime_quantum;
>>> -	signed short	slot;
>>> +	unsigned short	slot;
>>>    	int		localalloc_opt;
>>>    	unsigned int	resv_level;
>>>    	int		dir_resv_level;
>>> @@ -1349,7 +1349,7 @@ static int ocfs2_parse_options(struct super_block *sb,
>>>    				goto bail;
>>>    			}
>>>    			if (option)
>>> -				mopt->slot = (s16)option;
>>> +				mopt->slot = (u16)option;
>>>    			break;
>>>    		case Opt_commit:
>>>    			if (match_int(&args[0], &option)) {
>>>
>>
>>
>> _______________________________________________
>> Ocfs2-devel mailing list
>> Ocfs2-devel at oss.oracle.com
>> https://oss.oracle.com/mailman/listinfo/ocfs2-devel
>>
> 

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

* [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16
  2020-08-03  6:43     ` Gang He
@ 2020-08-04  0:45       ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2020-08-04  0:45 UTC (permalink / raw)
  To: ocfs2-devel

On Mon, 3 Aug 2020 14:43:23 +0800 Gang He <ghe@suse.com> wrote:

> Could you help to commit this patch to Linus git tree? since this patch 
> will fix the latest patch (ocfs2: fix value of OCFS2_INVALID_SLOT).
> So far, the current ocfs2 code under Linus git tree does NOT work.

It's in the queue for 5.9-rc1, with a cc:stable.

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

end of thread, other threads:[~2020-08-04  0:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27  0:12 [Ocfs2-devel] [PATCH] ocfs2: change slot number type s16 to u16 Junxiao Bi
2020-06-29  1:47 ` Joseph Qi
2020-07-03  8:45 ` Gang He
2020-07-03 12:11   ` Joseph Qi
2020-08-03  6:43     ` Gang He
2020-08-04  0:45       ` Andrew Morton

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