lkml.org 
[lkml]   [2010]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] use lock for 64-bit stats
Nitin Gupta wrote:
> +static void stat_dec(u32 *v)
> +{
> + *v = *v - 1;
> +}
> +
> +static void stat64_inc(struct ramzswap *rzs, u64 *v)
> +{
> + spin_lock(&rzs->stat64_lock);
> + *v = *v + 1;
> + spin_unlock(&rzs->stat64_lock);
> +}
> +
> +static void stat64_dec(struct ramzswap *rzs, u64 *v)
> +{
> + spin_lock(&rzs->stat64_lock);
> + *v = *v - 1;
> + spin_unlock(&rzs->stat64_lock);
> +}
> +
> +static u64 stat64_read(struct ramzswap *rzs, u64 *v)
> +{
> + u64 val;
> +
> + spin_lock(&rzs->stat64_lock);
> + val = *v;
> + spin_unlock(&rzs->stat64_lock);
> +
> + return val;
> +}
> +#else
> +#define stat_inc(v)
> +#define stat_dec(v)
> +#define stat64_inc(r, v)
> +#define stat64_dec(r, v)
> +#define stat64_read(r, v)
> +#endif /* CONFIG_RAMZSWAP_STATS */

I think I complained about this before: the names are too generic and
could collide with core kernel code. I think they ought to be called
ramzsawp_stat*().

Pekka


\
 
 \ /
  Last update: 2010-01-27 16:13    [W:0.379 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site