linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/quota: use unsigned int helper for sysctl fs.quota.*
@ 2019-11-07 10:08 Konstantin Khlebnikov
  2019-11-07 11:50 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Khlebnikov @ 2019-11-07 10:08 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, Jan Kara; +Cc: Dmitry Monakhov

Report counters as unsigned, otherwise they turn negative at overflow:

# sysctl fs.quota
fs.quota.allocated_dquots = 22327
fs.quota.cache_hits = -489852115
fs.quota.drops = -487288718
fs.quota.free_dquots = 22083
fs.quota.lookups = -486883485
fs.quota.reads = 22327
fs.quota.syncs = 335064
fs.quota.writes = 3088689

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 fs/quota/dquot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 6e826b454082..606e1e39674b 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2865,7 +2865,7 @@ static int do_proc_dqstats(struct ctl_table *table, int write,
 	/* Update global table */
 	dqstats.stat[type] =
 			percpu_counter_sum_positive(&dqstats.counter[type]);
-	return proc_dointvec(table, write, buffer, lenp, ppos);
+	return proc_douintvec(table, write, buffer, lenp, ppos);
 }
 
 static struct ctl_table fs_dqstats_table[] = {


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

* Re: [PATCH] fs/quota: use unsigned int helper for sysctl fs.quota.*
  2019-11-07 10:08 [PATCH] fs/quota: use unsigned int helper for sysctl fs.quota.* Konstantin Khlebnikov
@ 2019-11-07 11:50 ` Jan Kara
  2019-11-07 17:59   ` Konstantin Khlebnikov
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2019-11-07 11:50 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: linux-fsdevel, linux-kernel, Jan Kara, Dmitry Monakhov

On Thu 07-11-19 13:08:11, Konstantin Khlebnikov wrote:
> Report counters as unsigned, otherwise they turn negative at overflow:
> 
> # sysctl fs.quota
> fs.quota.allocated_dquots = 22327
> fs.quota.cache_hits = -489852115
> fs.quota.drops = -487288718
> fs.quota.free_dquots = 22083
> fs.quota.lookups = -486883485
> fs.quota.reads = 22327
> fs.quota.syncs = 335064
> fs.quota.writes = 3088689
> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

Fair enough but then 'stats' array in dqstats should be unsigned as well
for consistency and why not actually make everything long when we are at
it? percpu_counter we use is s64 anyway...

								Honza

> ---
>  fs/quota/dquot.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 6e826b454082..606e1e39674b 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -2865,7 +2865,7 @@ static int do_proc_dqstats(struct ctl_table *table, int write,
>  	/* Update global table */
>  	dqstats.stat[type] =
>  			percpu_counter_sum_positive(&dqstats.counter[type]);
> -	return proc_dointvec(table, write, buffer, lenp, ppos);
> +	return proc_douintvec(table, write, buffer, lenp, ppos);
>  }
>  
>  static struct ctl_table fs_dqstats_table[] = {
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH] fs/quota: use unsigned int helper for sysctl fs.quota.*
  2019-11-07 11:50 ` Jan Kara
@ 2019-11-07 17:59   ` Konstantin Khlebnikov
  0 siblings, 0 replies; 3+ messages in thread
From: Konstantin Khlebnikov @ 2019-11-07 17:59 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, linux-kernel, Jan Kara, Dmitry Monakhov

On 07/11/2019 14.50, Jan Kara wrote:
> On Thu 07-11-19 13:08:11, Konstantin Khlebnikov wrote:
>> Report counters as unsigned, otherwise they turn negative at overflow:
>>
>> # sysctl fs.quota
>> fs.quota.allocated_dquots = 22327
>> fs.quota.cache_hits = -489852115
>> fs.quota.drops = -487288718
>> fs.quota.free_dquots = 22083
>> fs.quota.lookups = -486883485
>> fs.quota.reads = 22327
>> fs.quota.syncs = 335064
>> fs.quota.writes = 3088689
>>
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> 
> Fair enough but then 'stats' array in dqstats should be unsigned as well
> for consistency and why not actually make everything long when we are at
> it? percpu_counter we use is s64 anyway...

Ok. I'll patch this too.

> 
> 								Honza
> 
>> ---
>>   fs/quota/dquot.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
>> index 6e826b454082..606e1e39674b 100644
>> --- a/fs/quota/dquot.c
>> +++ b/fs/quota/dquot.c
>> @@ -2865,7 +2865,7 @@ static int do_proc_dqstats(struct ctl_table *table, int write,
>>   	/* Update global table */
>>   	dqstats.stat[type] =
>>   			percpu_counter_sum_positive(&dqstats.counter[type]);
>> -	return proc_dointvec(table, write, buffer, lenp, ppos);
>> +	return proc_douintvec(table, write, buffer, lenp, ppos);
>>   }
>>   
>>   static struct ctl_table fs_dqstats_table[] = {
>>

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

end of thread, other threads:[~2019-11-07 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 10:08 [PATCH] fs/quota: use unsigned int helper for sysctl fs.quota.* Konstantin Khlebnikov
2019-11-07 11:50 ` Jan Kara
2019-11-07 17:59   ` Konstantin Khlebnikov

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