diff options
author | Michael Callahan <michaelcallahan@fb.com> | 2018-07-18 04:47:37 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-07-18 08:44:16 -0600 |
commit | 59767fbd49d794b4499d30b314df6c0d4aca584b (patch) | |
tree | c9c02d6336a9408343a08065a032745740e898b2 /include/linux/genhd.h | |
parent | 3f289dcb4b265416a57ca79cf4a324060bb09060 (diff) | |
download | linux-59767fbd49d794b4499d30b314df6c0d4aca584b.tar.gz linux-59767fbd49d794b4499d30b314df6c0d4aca584b.tar.bz2 linux-59767fbd49d794b4499d30b314df6c0d4aca584b.zip |
block: Add part_stat_read_accum to read across field entries.
Add a part_stat_read_accum macro to genhd.h to read and sum across
field entries. For example to sum up the number read and write
sectors completed. In addition to being ar reasonable cleanup by
itself this will make it easier to add new stat fields in the future.
tj: Refreshed on top of v4.17.
Signed-off-by: Michael Callahan <michaelcallahan@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r-- | include/linux/genhd.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 6cb8a5789668..19f36fa10995 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -353,6 +353,10 @@ static inline void free_part_stats(struct hd_struct *part) #endif /* CONFIG_SMP */ +#define part_stat_read_accum(part, field) \ + (part_stat_read(part, field[0]) + \ + part_stat_read(part, field[1])) + #define part_stat_add(cpu, part, field, addnd) do { \ __part_stat_add((cpu), (part), field, addnd); \ if ((part)->partno) \ |