aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-08-08 17:49:47 -0600
committerJens Axboe <axboe@kernel.dk>2017-08-09 13:09:20 -0600
commit0609e0efc5e15195ecf8c6d2f2e890d98760e337 (patch)
tree375a8c090f2b2022de3339bc3960e95b3878de7a /include
parentblock: pass in queue to inflight accounting (diff)
downloadlinux-dev-0609e0efc5e15195ecf8c6d2f2e890d98760e337.tar.xz
linux-dev-0609e0efc5e15195ecf8c6d2f2e890d98760e337.zip
block: make part_in_flight() take an array of two ints
Instead of returning the count that matches the partition, pass in an array of two ints. Index 0 will be filled with the inflight count for the partition in question, and index 1 will filled with the root inflight count, if the partition passed in is not the root. This is in preparation for being able to calculate both in one go. Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/genhd.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 7f7427e00f9c..f2a3a26cdda1 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -378,11 +378,18 @@ static inline void part_dec_in_flight(struct request_queue *q,
atomic_dec(&part_to_disk(part)->part0.in_flight[rw]);
}
-static inline int part_in_flight(struct request_queue *q,
- struct hd_struct *part)
+static inline void part_in_flight(struct request_queue *q,
+ struct hd_struct *part,
+ unsigned int inflight[2])
{
- return atomic_read(&part->in_flight[0]) +
+ inflight[0] = atomic_read(&part->in_flight[0]) +
atomic_read(&part->in_flight[1]);
+ if (part->partno) {
+ part = &part_to_disk(part)->part0;
+ inflight[1] = atomic_read(&part->in_flight[0]) +
+ atomic_read(&part->in_flight[1]);
+ } else
+ inflight[1] = 0;
}
static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)