From 90703870b9f2ae36ef6a7f22cbfe3b11eeb56def Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 6 Nov 2007 11:33:54 -0800 Subject: [PATCH] cpu alloc: NFS statistics Signed-off-by: Christoph Lameter --- fs/nfs/iostat.h | 20 ++++---------------- fs/nfs/super.c | 2 +- 2 files changed, 5 insertions(+), 17 deletions(-) Index: linux-2.6/fs/nfs/iostat.h =================================================================== --- linux-2.6.orig/fs/nfs/iostat.h 2007-11-20 18:24:35.416625533 -0800 +++ linux-2.6/fs/nfs/iostat.h 2007-11-20 18:49:00.076078321 -0800 @@ -119,13 +119,7 @@ struct nfs_iostats { static inline void nfs_inc_server_stats(struct nfs_server *server, enum nfs_stat_eventcounters stat) { - struct nfs_iostats *iostats; - int cpu; - - cpu = get_cpu(); - iostats = per_cpu_ptr(server->io_stats, cpu); - iostats->events[stat] ++; - put_cpu_no_resched(); + _CPU_INC(server->io_stats->events[stat]); } static inline void nfs_inc_stats(struct inode *inode, enum nfs_stat_eventcounters stat) @@ -135,13 +129,7 @@ static inline void nfs_inc_stats(struct static inline void nfs_add_server_stats(struct nfs_server *server, enum nfs_stat_bytecounters stat, unsigned long addend) { - struct nfs_iostats *iostats; - int cpu; - - cpu = get_cpu(); - iostats = per_cpu_ptr(server->io_stats, cpu); - iostats->bytes[stat] += addend; - put_cpu_no_resched(); + _CPU_INC(server->io_stats->bytes[stat]); } static inline void nfs_add_stats(struct inode *inode, enum nfs_stat_bytecounters stat, unsigned long addend) @@ -151,13 +139,13 @@ static inline void nfs_add_stats(struct static inline struct nfs_iostats *nfs_alloc_iostats(void) { - return alloc_percpu(struct nfs_iostats); + return CPU_ALLOC(struct nfs_iostats, GFP_KERNEL | __GFP_ZERO); } static inline void nfs_free_iostats(struct nfs_iostats *stats) { if (stats != NULL) - free_percpu(stats); + CPU_FREE(stats); } #endif Index: linux-2.6/fs/nfs/super.c =================================================================== --- linux-2.6.orig/fs/nfs/super.c 2007-11-20 18:24:35.424625565 -0800 +++ linux-2.6/fs/nfs/super.c 2007-11-20 18:49:48.977125036 -0800 @@ -529,7 +529,7 @@ static int nfs_show_stats(struct seq_fil struct nfs_iostats *stats; preempt_disable(); - stats = per_cpu_ptr(nfss->io_stats, cpu); + stats = CPU_PTR(nfss->io_stats, cpu); for (i = 0; i < __NFSIOS_COUNTSMAX; i++) totals.events[i] += stats->events[i];