summaryrefslogtreecommitdiff
path: root/include/linux/part_stat.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-24 11:34:00 +0300
committerJens Axboe <axboe@kernel.dk>2020-12-02 00:53:40 +0300
commit15e3d2c5cd53298272e59ad9072d3468f9dd3781 (patch)
treee526446b6b09c036e9aed966dbe2bdd252f5bb98 /include/linux/part_stat.h
parenta782483cc1f875355690625d8253a232f2581418 (diff)
downloadlinux-15e3d2c5cd53298272e59ad9072d3468f9dd3781.tar.xz
block: move disk stat accounting to struct block_device
Move the dkstats and stamp field to struct block_device in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/part_stat.h')
-rw-r--r--include/linux/part_stat.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/include/linux/part_stat.h b/include/linux/part_stat.h
index 24125778ef3e..87ad60106e1d 100644
--- a/include/linux/part_stat.h
+++ b/include/linux/part_stat.h
@@ -25,17 +25,17 @@ struct disk_stats {
#define part_stat_unlock() preempt_enable()
#define part_stat_get_cpu(part, field, cpu) \
- (per_cpu_ptr((part)->dkstats, (cpu))->field)
+ (per_cpu_ptr((part)->bdev->bd_stats, (cpu))->field)
#define part_stat_get(part, field) \
part_stat_get_cpu(part, field, smp_processor_id())
#define part_stat_read(part, field) \
({ \
- typeof((part)->dkstats->field) res = 0; \
+ typeof((part)->bdev->bd_stats->field) res = 0; \
unsigned int _cpu; \
for_each_possible_cpu(_cpu) \
- res += per_cpu_ptr((part)->dkstats, _cpu)->field; \
+ res += per_cpu_ptr((part)->bdev->bd_stats, _cpu)->field; \
res; \
})
@@ -44,7 +44,7 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
int i;
for_each_possible_cpu(i)
- memset(per_cpu_ptr(part->dkstats, i), value,
+ memset(per_cpu_ptr(part->bdev->bd_stats, i), value,
sizeof(struct disk_stats));
}
@@ -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) \
- __this_cpu_add((part)->dkstats->field, addnd)
+ __this_cpu_add((part)->bdev->bd_stats->field, addnd)
#define part_stat_add(part, field, addnd) do { \
__part_stat_add((part), field, addnd); \
@@ -63,20 +63,20 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
field, addnd); \
} while (0)
-#define part_stat_dec(gendiskp, field) \
- part_stat_add(gendiskp, field, -1)
-#define part_stat_inc(gendiskp, field) \
- part_stat_add(gendiskp, field, 1)
-#define part_stat_sub(gendiskp, field, subnd) \
- part_stat_add(gendiskp, field, -subnd)
+#define part_stat_dec(part, field) \
+ part_stat_add(part, field, -1)
+#define part_stat_inc(part, field) \
+ part_stat_add(part, field, 1)
+#define part_stat_sub(part, field, subnd) \
+ part_stat_add(part, field, -subnd)
-#define part_stat_local_dec(gendiskp, field) \
- local_dec(&(part_stat_get(gendiskp, field)))
-#define part_stat_local_inc(gendiskp, field) \
- local_inc(&(part_stat_get(gendiskp, field)))
-#define part_stat_local_read(gendiskp, field) \
- local_read(&(part_stat_get(gendiskp, field)))
-#define part_stat_local_read_cpu(gendiskp, field, cpu) \
- local_read(&(part_stat_get_cpu(gendiskp, field, cpu)))
+#define part_stat_local_dec(part, field) \
+ local_dec(&(part_stat_get(part, field)))
+#define part_stat_local_inc(part, field) \
+ local_inc(&(part_stat_get(part, field)))
+#define part_stat_local_read(part, field) \
+ local_read(&(part_stat_get(part, field)))
+#define part_stat_local_read_cpu(part, field, cpu) \
+ local_read(&(part_stat_get_cpu(part, field, cpu)))
#endif /* _LINUX_PART_STAT_H */