Most architectures have fast path to access percpu for current cpu. Required preempt_disable() is provided by part_stat_lock(). Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxxxxxx> --- include/linux/part_stat.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/part_stat.h b/include/linux/part_stat.h index 755a01f0fd61..a0ddeff3798e 100644 --- a/include/linux/part_stat.h +++ b/include/linux/part_stat.h @@ -36,6 +36,9 @@ res; \ }) +#define __part_stat_add(part, field, addnd) \ + __this_cpu_add((part)->dkstats->field, addnd) + static inline void part_stat_set_all(struct hd_struct *part, int value) { int i; @@ -64,6 +67,9 @@ static inline void free_part_stats(struct hd_struct *part) #define part_stat_get_cpu(part, field, cpu) part_stat_get(part, field) #define part_stat_read(part, field) part_stat_get(part, field) +#define __part_stat_add(part, field, addnd) \ + (part_stat_get(part, field) += (addnd)) + static inline void part_stat_set_all(struct hd_struct *part, int value) { memset(&part->dkstats, value, sizeof(struct disk_stats)); @@ -85,9 +91,6 @@ static inline void free_part_stats(struct hd_struct *part) part_stat_read(part, field[STAT_WRITE]) + \ part_stat_read(part, field[STAT_DISCARD])) -#define __part_stat_add(part, field, addnd) \ - (part_stat_get(part, field) += (addnd)) - #define part_stat_add(part, field, addnd) do { \ __part_stat_add((part), field, addnd); \ if ((part)->partno) \