block: use __this_cpu_add() instead of access by smp_processor_id()

Most architectures have fast path to access percpu for current cpu.
The required preempt_disable() is provided by part_stat_lock().

[hch: rebased]

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Konstantin Khlebnikov 2020-05-27 07:24:18 +02:00 committed by Jens Axboe
parent 8ab1d40a64
commit b2d76adbc0

View File

@ -54,7 +54,7 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
part_stat_read(part, field[STAT_DISCARD]))
#define __part_stat_add(part, field, addnd) \
(part_stat_get(part, field) += (addnd))
__this_cpu_add((part)->dkstats->field, addnd)
#define part_stat_add(part, field, addnd) do { \
__part_stat_add((part), field, addnd); \