diff options
author | Omar Sandoval <osandov@fb.com> | 2018-04-26 03:21:59 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-04-26 11:02:01 -0400 |
commit | bf0ddaba65ddbb2715af97041da8e7a45b2d8628 (patch) | |
tree | 42ecea860351829817753e8ce2c4205a8aaff8b1 /block/genhd.c | |
parent | 6131837b1de66116459ef4413e26fdbc70d066dc (diff) |
blk-mq: fix sysfs inflight counter
When the blk-mq inflight implementation was added, /proc/diskstats was
converted to use it, but /sys/block/$dev/inflight was not. Fix it by
adding another helper to count in-flight requests by data direction.
Fixes: f299b7c7a9de ("blk-mq: provide internal in-flight variant")
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c index dc7e089373b9..c4513fe1adda 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -82,6 +82,18 @@ void part_in_flight(struct request_queue *q, struct hd_struct *part, | |||
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | void part_in_flight_rw(struct request_queue *q, struct hd_struct *part, | ||
86 | unsigned int inflight[2]) | ||
87 | { | ||
88 | if (q->mq_ops) { | ||
89 | blk_mq_in_flight_rw(q, part, inflight); | ||
90 | return; | ||
91 | } | ||
92 | |||
93 | inflight[0] = atomic_read(&part->in_flight[0]); | ||
94 | inflight[1] = atomic_read(&part->in_flight[1]); | ||
95 | } | ||
96 | |||
85 | struct hd_struct *__disk_get_part(struct gendisk *disk, int partno) | 97 | struct hd_struct *__disk_get_part(struct gendisk *disk, int partno) |
86 | { | 98 | { |
87 | struct disk_part_tbl *ptbl = rcu_dereference(disk->part_tbl); | 99 | struct disk_part_tbl *ptbl = rcu_dereference(disk->part_tbl); |