summaryrefslogtreecommitdiffstats
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
authorMichael Callahan <michaelcallahan@fb.com>2018-07-18 07:47:38 -0400
committerJens Axboe <axboe@kernel.dk>2018-07-18 10:44:18 -0400
commitdbae2c551377b6533a00c11fc7ede370100ab404 (patch)
treebbbfb46c0d4c3ff3b9250f70453b259c58e89539 /include/linux/genhd.h
parent59767fbd49d794b4499d30b314df6c0d4aca584b (diff)
block: Define and use STAT_READ and STAT_WRITE
Add defines for STAT_READ and STAT_WRITE for indexing the partition stat entries. This clarifies some fs/ code which has hardcoded 1 for STAT_WRITE and will make it easier to extend the stats with additional fields. tj: Refreshed on top of v4.17. Signed-off-by: Michael Callahan <michaelcallahan@fb.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r--include/linux/genhd.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 19f36fa10995..a75445446974 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -16,6 +16,7 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/percpu-refcount.h> 17#include <linux/percpu-refcount.h>
18#include <linux/uuid.h> 18#include <linux/uuid.h>
19#include <linux/blk_types.h>
19 20
20#ifdef CONFIG_BLOCK 21#ifdef CONFIG_BLOCK
21 22
@@ -82,10 +83,10 @@ struct partition {
82} __attribute__((packed)); 83} __attribute__((packed));
83 84
84struct disk_stats { 85struct disk_stats {
85 unsigned long sectors[2]; /* READs and WRITEs */ 86 unsigned long sectors[NR_STAT_GROUPS];
86 unsigned long ios[2]; 87 unsigned long ios[NR_STAT_GROUPS];
87 unsigned long merges[2]; 88 unsigned long merges[NR_STAT_GROUPS];
88 unsigned long ticks[2]; 89 unsigned long ticks[NR_STAT_GROUPS];
89 unsigned long io_ticks; 90 unsigned long io_ticks;
90 unsigned long time_in_queue; 91 unsigned long time_in_queue;
91}; 92};
@@ -354,8 +355,8 @@ static inline void free_part_stats(struct hd_struct *part)
354#endif /* CONFIG_SMP */ 355#endif /* CONFIG_SMP */
355 356
356#define part_stat_read_accum(part, field) \ 357#define part_stat_read_accum(part, field) \
357 (part_stat_read(part, field[0]) + \ 358 (part_stat_read(part, field[STAT_READ]) + \
358 part_stat_read(part, field[1])) 359 part_stat_read(part, field[STAT_WRITE]))
359 360
360#define part_stat_add(cpu, part, field, addnd) do { \ 361#define part_stat_add(cpu, part, field, addnd) do { \
361 __part_stat_add((cpu), (part), field, addnd); \ 362 __part_stat_add((cpu), (part), field, addnd); \