diff options
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c index 822f65f95e2a..3dc4d115480f 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -45,6 +45,43 @@ static void disk_add_events(struct gendisk *disk); | |||
45 | static void disk_del_events(struct gendisk *disk); | 45 | static void disk_del_events(struct gendisk *disk); |
46 | static void disk_release_events(struct gendisk *disk); | 46 | static void disk_release_events(struct gendisk *disk); |
47 | 47 | ||
48 | void part_inc_in_flight(struct request_queue *q, struct hd_struct *part, int rw) | ||
49 | { | ||
50 | if (q->mq_ops) | ||
51 | return; | ||
52 | |||
53 | atomic_inc(&part->in_flight[rw]); | ||
54 | if (part->partno) | ||
55 | atomic_inc(&part_to_disk(part)->part0.in_flight[rw]); | ||
56 | } | ||
57 | |||
58 | void part_dec_in_flight(struct request_queue *q, struct hd_struct *part, int rw) | ||
59 | { | ||
60 | if (q->mq_ops) | ||
61 | return; | ||
62 | |||
63 | atomic_dec(&part->in_flight[rw]); | ||
64 | if (part->partno) | ||
65 | atomic_dec(&part_to_disk(part)->part0.in_flight[rw]); | ||
66 | } | ||
67 | |||
68 | void part_in_flight(struct request_queue *q, struct hd_struct *part, | ||
69 | unsigned int inflight[2]) | ||
70 | { | ||
71 | if (q->mq_ops) { | ||
72 | blk_mq_in_flight(q, part, inflight); | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | inflight[0] = atomic_read(&part->in_flight[0]) + | ||
77 | atomic_read(&part->in_flight[1]); | ||
78 | if (part->partno) { | ||
79 | part = &part_to_disk(part)->part0; | ||
80 | inflight[1] = atomic_read(&part->in_flight[0]) + | ||
81 | atomic_read(&part->in_flight[1]); | ||
82 | } | ||
83 | } | ||
84 | |||
48 | /** | 85 | /** |
49 | * disk_get_part - get partition | 86 | * disk_get_part - get partition |
50 | * @disk: disk to look partition from | 87 | * @disk: disk to look partition from |