From b2880a086e2fbf8d43f668fa750f2edced64849c Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 6 Nov 2007 11:33:52 -0800 Subject: [PATCH] cpu alloc: genhd statistics conversion Signed-off-by: Christoph Lameter --- include/linux/genhd.h | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index a47b802..7afb0c6 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -12,6 +12,7 @@ #include #ifdef CONFIG_BLOCK +#include enum { /* These three have identical behaviour; use the second one if DOS FDISK gets @@ -158,21 +159,21 @@ struct disk_attribute { */ #ifdef CONFIG_SMP #define __disk_stat_add(gendiskp, field, addnd) \ - (per_cpu_ptr(gendiskp->dkstats, smp_processor_id())->field += addnd) + (THIS_CPU(gendiskp->dkstats)->field += addnd) #define disk_stat_read(gendiskp, field) \ ({ \ typeof(gendiskp->dkstats->field) res = 0; \ int i; \ for_each_possible_cpu(i) \ - res += per_cpu_ptr(gendiskp->dkstats, i)->field; \ + res += CPU_PTR(gendiskp->dkstats, i)->field; \ res; \ }) static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { int i; for_each_possible_cpu(i) - memset(per_cpu_ptr(gendiskp->dkstats, i), value, + memset(CPU_PTR(gendiskp->dkstats, i), value, sizeof (struct disk_stats)); } @@ -209,7 +210,7 @@ static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { #ifdef CONFIG_SMP static inline int init_disk_stats(struct gendisk *disk) { - disk->dkstats = alloc_percpu(struct disk_stats); + disk->dkstats = CPU_ALLOC(struct disk_stats, GFP_KERNEL | __GFP_ZERO); if (!disk->dkstats) return 0; return 1; @@ -217,7 +218,7 @@ static inline int init_disk_stats(struct gendisk *disk) static inline void free_disk_stats(struct gendisk *disk) { - free_percpu(disk->dkstats); + CPU_FREE(disk->dkstats); } #else /* CONFIG_SMP */ static inline int init_disk_stats(struct gendisk *disk) -- 1.5.3.4