Commit fce22848 authored by Christoph Lameter's avatar Christoph Lameter Committed by Tejun Heo

this_cpu: Use this_cpu operations for NFS statistics

Simplify NFS statistics and allow the use of optimized
arch instructions.
Acked-by: default avatarTejun Heo <tj@kernel.org>
CC: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: default avatarChristoph Lameter <cl@linux-foundation.org>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 4eb41d10
...@@ -25,13 +25,7 @@ struct nfs_iostats { ...@@ -25,13 +25,7 @@ struct nfs_iostats {
static inline void nfs_inc_server_stats(const struct nfs_server *server, static inline void nfs_inc_server_stats(const struct nfs_server *server,
enum nfs_stat_eventcounters stat) enum nfs_stat_eventcounters stat)
{ {
struct nfs_iostats *iostats; this_cpu_inc(server->io_stats->events[stat]);
int cpu;
cpu = get_cpu();
iostats = per_cpu_ptr(server->io_stats, cpu);
iostats->events[stat]++;
put_cpu();
} }
static inline void nfs_inc_stats(const struct inode *inode, static inline void nfs_inc_stats(const struct inode *inode,
...@@ -44,13 +38,7 @@ static inline void nfs_add_server_stats(const struct nfs_server *server, ...@@ -44,13 +38,7 @@ static inline void nfs_add_server_stats(const struct nfs_server *server,
enum nfs_stat_bytecounters stat, enum nfs_stat_bytecounters stat,
unsigned long addend) unsigned long addend)
{ {
struct nfs_iostats *iostats; this_cpu_add(server->io_stats->bytes[stat], addend);
int cpu;
cpu = get_cpu();
iostats = per_cpu_ptr(server->io_stats, cpu);
iostats->bytes[stat] += addend;
put_cpu();
} }
static inline void nfs_add_stats(const struct inode *inode, static inline void nfs_add_stats(const struct inode *inode,
...@@ -65,13 +53,7 @@ static inline void nfs_add_fscache_stats(struct inode *inode, ...@@ -65,13 +53,7 @@ static inline void nfs_add_fscache_stats(struct inode *inode,
enum nfs_stat_fscachecounters stat, enum nfs_stat_fscachecounters stat,
unsigned long addend) unsigned long addend)
{ {
struct nfs_iostats *iostats; this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend);
int cpu;
cpu = get_cpu();
iostats = per_cpu_ptr(NFS_SERVER(inode)->io_stats, cpu);
iostats->fscache[stat] += addend;
put_cpu();
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment