summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-06-30 23:55:08 -0400
committerJens Axboe <axboe@kernel.dk>2017-08-09 15:09:16 -0400
commitd62e26b3ffd28f16ddae85a1babd0303a1a6dfb6 (patch)
tree622dd61c60712f31575b2cdde0811529b829ba8a
parent7f5562d5ecc44c757599b201df928ba52fa05047 (diff)
block: pass in queue to inflight accounting
No functional change in this patch, just in preparation for basing the inflight mechanism on the queue in question. Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/bio.c16
-rw-r--r--block/blk-core.c22
-rw-r--r--block/blk-merge.c4
-rw-r--r--block/genhd.c4
-rw-r--r--block/partition-generic.c5
-rw-r--r--drivers/block/drbd/drbd_req.c10
-rw-r--r--drivers/block/rsxx/dev.c6
-rw-r--r--drivers/block/zram/zram_drv.c5
-rw-r--r--drivers/md/bcache/request.c7
-rw-r--r--drivers/md/dm.c6
-rw-r--r--drivers/nvdimm/nd.h5
-rw-r--r--include/linux/bio.h9
-rw-r--r--include/linux/genhd.h14
13 files changed, 64 insertions, 49 deletions
diff --git a/block/bio.c b/block/bio.c
index e241bbc49f14..ecd1a9c7a301 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1736,29 +1736,29 @@ void bio_check_pages_dirty(struct bio *bio)
1736 } 1736 }
1737} 1737}
1738 1738
1739void generic_start_io_acct(int rw, unsigned long sectors, 1739void generic_start_io_acct(struct request_queue *q, int rw,
1740 struct hd_struct *part) 1740 unsigned long sectors, struct hd_struct *part)
1741{ 1741{
1742 int cpu = part_stat_lock(); 1742 int cpu = part_stat_lock();
1743 1743
1744 part_round_stats(cpu, part); 1744 part_round_stats(q, cpu, part);
1745 part_stat_inc(cpu, part, ios[rw]); 1745 part_stat_inc(cpu, part, ios[rw]);
1746 part_stat_add(cpu, part, sectors[rw], sectors); 1746 part_stat_add(cpu, part, sectors[rw], sectors);
1747 part_inc_in_flight(part, rw); 1747 part_inc_in_flight(q, part, rw);
1748 1748
1749 part_stat_unlock(); 1749 part_stat_unlock();
1750} 1750}
1751EXPORT_SYMBOL(generic_start_io_acct); 1751EXPORT_SYMBOL(generic_start_io_acct);
1752 1752
1753void generic_end_io_acct(int rw, struct hd_struct *part, 1753void generic_end_io_acct(struct request_queue *q, int rw,
1754 unsigned long start_time) 1754 struct hd_struct *part, unsigned long start_time)
1755{ 1755{
1756 unsigned long duration = jiffies - start_time; 1756 unsigned long duration = jiffies - start_time;
1757 int cpu = part_stat_lock(); 1757 int cpu = part_stat_lock();
1758 1758
1759 part_stat_add(cpu, part, ticks[rw], duration); 1759 part_stat_add(cpu, part, ticks[rw], duration);
1760 part_round_stats(cpu, part); 1760 part_round_stats(q, cpu, part);
1761 part_dec_in_flight(part, rw); 1761 part_dec_in_flight(q, part, rw);
1762 1762
1763 part_stat_unlock(); 1763 part_stat_unlock();
1764} 1764}
diff --git a/block/blk-core.c b/block/blk-core.c
index dbecbf4a64e0..8ee954c12e9d 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1469,15 +1469,15 @@ static void add_acct_request(struct request_queue *q, struct request *rq,
1469 __elv_add_request(q, rq, where); 1469 __elv_add_request(q, rq, where);
1470} 1470}
1471 1471
1472static void part_round_stats_single(int cpu, struct hd_struct *part, 1472static void part_round_stats_single(struct request_queue *q, int cpu,
1473 unsigned long now) 1473 struct hd_struct *part, unsigned long now)
1474{ 1474{
1475 int inflight; 1475 int inflight;
1476 1476
1477 if (now == part->stamp) 1477 if (now == part->stamp)
1478 return; 1478 return;
1479 1479
1480 inflight = part_in_flight(part); 1480 inflight = part_in_flight(q, part);
1481 if (inflight) { 1481 if (inflight) {
1482 __part_stat_add(cpu, part, time_in_queue, 1482 __part_stat_add(cpu, part, time_in_queue,
1483 inflight * (now - part->stamp)); 1483 inflight * (now - part->stamp));
@@ -1488,6 +1488,7 @@ static void part_round_stats_single(int cpu, struct hd_struct *part,
1488 1488
1489/** 1489/**
1490 * part_round_stats() - Round off the performance stats on a struct disk_stats. 1490 * part_round_stats() - Round off the performance stats on a struct disk_stats.
1491 * @q: target block queue
1491 * @cpu: cpu number for stats access 1492 * @cpu: cpu number for stats access
1492 * @part: target partition 1493 * @part: target partition
1493 * 1494 *
@@ -1502,13 +1503,14 @@ static void part_round_stats_single(int cpu, struct hd_struct *part,
1502 * /proc/diskstats. This accounts immediately for all queue usage up to 1503 * /proc/diskstats. This accounts immediately for all queue usage up to
1503 * the current jiffies and restarts the counters again. 1504 * the current jiffies and restarts the counters again.
1504 */ 1505 */
1505void part_round_stats(int cpu, struct hd_struct *part) 1506void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part)
1506{ 1507{
1507 unsigned long now = jiffies; 1508 unsigned long now = jiffies;
1508 1509
1509 if (part->partno) 1510 if (part->partno)
1510 part_round_stats_single(cpu, &part_to_disk(part)->part0, now); 1511 part_round_stats_single(q, cpu, &part_to_disk(part)->part0,
1511 part_round_stats_single(cpu, part, now); 1512 now);
1513 part_round_stats_single(q, cpu, part, now);
1512} 1514}
1513EXPORT_SYMBOL_GPL(part_round_stats); 1515EXPORT_SYMBOL_GPL(part_round_stats);
1514 1516
@@ -2431,8 +2433,8 @@ void blk_account_io_done(struct request *req)
2431 2433
2432 part_stat_inc(cpu, part, ios[rw]); 2434 part_stat_inc(cpu, part, ios[rw]);
2433 part_stat_add(cpu, part, ticks[rw], duration); 2435 part_stat_add(cpu, part, ticks[rw], duration);
2434 part_round_stats(cpu, part); 2436 part_round_stats(req->q, cpu, part);
2435 part_dec_in_flight(part, rw); 2437 part_dec_in_flight(req->q, part, rw);
2436 2438
2437 hd_struct_put(part); 2439 hd_struct_put(part);
2438 part_stat_unlock(); 2440 part_stat_unlock();
@@ -2489,8 +2491,8 @@ void blk_account_io_start(struct request *rq, bool new_io)
2489 part = &rq->rq_disk->part0; 2491 part = &rq->rq_disk->part0;
2490 hd_struct_get(part); 2492 hd_struct_get(part);
2491 } 2493 }
2492 part_round_stats(cpu, part); 2494 part_round_stats(rq->q, cpu, part);
2493 part_inc_in_flight(part, rw); 2495 part_inc_in_flight(rq->q, part, rw);
2494 rq->part = part; 2496 rq->part = part;
2495 } 2497 }
2496 2498
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 99038830fb42..05f116bfb99d 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -633,8 +633,8 @@ static void blk_account_io_merge(struct request *req)
633 cpu = part_stat_lock(); 633 cpu = part_stat_lock();
634 part = req->part; 634 part = req->part;
635 635
636 part_round_stats(cpu, part); 636 part_round_stats(req->q, cpu, part);
637 part_dec_in_flight(part, rq_data_dir(req)); 637 part_dec_in_flight(req->q, part, rq_data_dir(req));
638 638
639 hd_struct_put(part); 639 hd_struct_put(part);
640 part_stat_unlock(); 640 part_stat_unlock();
diff --git a/block/genhd.c b/block/genhd.c
index 7f520fa25d16..f735af67a0c9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1217,7 +1217,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
1217 disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0); 1217 disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0);
1218 while ((hd = disk_part_iter_next(&piter))) { 1218 while ((hd = disk_part_iter_next(&piter))) {
1219 cpu = part_stat_lock(); 1219 cpu = part_stat_lock();
1220 part_round_stats(cpu, hd); 1220 part_round_stats(gp->queue, cpu, hd);
1221 part_stat_unlock(); 1221 part_stat_unlock();
1222 seq_printf(seqf, "%4d %7d %s %lu %lu %lu " 1222 seq_printf(seqf, "%4d %7d %s %lu %lu %lu "
1223 "%u %lu %lu %lu %u %u %u %u\n", 1223 "%u %lu %lu %lu %u %u %u %u\n",
@@ -1231,7 +1231,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
1231 part_stat_read(hd, merges[WRITE]), 1231 part_stat_read(hd, merges[WRITE]),
1232 part_stat_read(hd, sectors[WRITE]), 1232 part_stat_read(hd, sectors[WRITE]),
1233 jiffies_to_msecs(part_stat_read(hd, ticks[WRITE])), 1233 jiffies_to_msecs(part_stat_read(hd, ticks[WRITE])),
1234 part_in_flight(hd), 1234 part_in_flight(gp->queue, hd),
1235 jiffies_to_msecs(part_stat_read(hd, io_ticks)), 1235 jiffies_to_msecs(part_stat_read(hd, io_ticks)),
1236 jiffies_to_msecs(part_stat_read(hd, time_in_queue)) 1236 jiffies_to_msecs(part_stat_read(hd, time_in_queue))
1237 ); 1237 );
diff --git a/block/partition-generic.c b/block/partition-generic.c
index c5ec8246e25e..d1bdd61e1d71 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -112,10 +112,11 @@ ssize_t part_stat_show(struct device *dev,
112 struct device_attribute *attr, char *buf) 112 struct device_attribute *attr, char *buf)
113{ 113{
114 struct hd_struct *p = dev_to_part(dev); 114 struct hd_struct *p = dev_to_part(dev);
115 struct request_queue *q = dev_to_disk(dev)->queue;
115 int cpu; 116 int cpu;
116 117
117 cpu = part_stat_lock(); 118 cpu = part_stat_lock();
118 part_round_stats(cpu, p); 119 part_round_stats(q, cpu, p);
119 part_stat_unlock(); 120 part_stat_unlock();
120 return sprintf(buf, 121 return sprintf(buf,
121 "%8lu %8lu %8llu %8u " 122 "%8lu %8lu %8llu %8u "
@@ -130,7 +131,7 @@ ssize_t part_stat_show(struct device *dev,
130 part_stat_read(p, merges[WRITE]), 131 part_stat_read(p, merges[WRITE]),
131 (unsigned long long)part_stat_read(p, sectors[WRITE]), 132 (unsigned long long)part_stat_read(p, sectors[WRITE]),
132 jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), 133 jiffies_to_msecs(part_stat_read(p, ticks[WRITE])),
133 part_in_flight(p), 134 part_in_flight(q, p),
134 jiffies_to_msecs(part_stat_read(p, io_ticks)), 135 jiffies_to_msecs(part_stat_read(p, io_ticks)),
135 jiffies_to_msecs(part_stat_read(p, time_in_queue))); 136 jiffies_to_msecs(part_stat_read(p, time_in_queue)));
136} 137}
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index f6e865b2d543..8d6b5d137b5e 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -36,14 +36,18 @@ static bool drbd_may_do_local_read(struct drbd_device *device, sector_t sector,
36/* Update disk stats at start of I/O request */ 36/* Update disk stats at start of I/O request */
37static void _drbd_start_io_acct(struct drbd_device *device, struct drbd_request *req) 37static void _drbd_start_io_acct(struct drbd_device *device, struct drbd_request *req)
38{ 38{
39 generic_start_io_acct(bio_data_dir(req->master_bio), req->i.size >> 9, 39 struct request_queue *q = device->rq_queue;
40 &device->vdisk->part0); 40
41 generic_start_io_acct(q, bio_data_dir(req->master_bio),
42 req->i.size >> 9, &device->vdisk->part0);
41} 43}
42 44
43/* Update disk stats when completing request upwards */ 45/* Update disk stats when completing request upwards */
44static void _drbd_end_io_acct(struct drbd_device *device, struct drbd_request *req) 46static void _drbd_end_io_acct(struct drbd_device *device, struct drbd_request *req)
45{ 47{
46 generic_end_io_acct(bio_data_dir(req->master_bio), 48 struct request_queue *q = device->rq_queue;
49
50 generic_end_io_acct(q, bio_data_dir(req->master_bio),
47 &device->vdisk->part0, req->start_jif); 51 &device->vdisk->part0, req->start_jif);
48} 52}
49 53
diff --git a/drivers/block/rsxx/dev.c b/drivers/block/rsxx/dev.c
index 7f4acebf4657..e397d3ee7308 100644
--- a/drivers/block/rsxx/dev.c
+++ b/drivers/block/rsxx/dev.c
@@ -112,7 +112,7 @@ static const struct block_device_operations rsxx_fops = {
112 112
113static void disk_stats_start(struct rsxx_cardinfo *card, struct bio *bio) 113static void disk_stats_start(struct rsxx_cardinfo *card, struct bio *bio)
114{ 114{
115 generic_start_io_acct(bio_data_dir(bio), bio_sectors(bio), 115 generic_start_io_acct(card->queue, bio_data_dir(bio), bio_sectors(bio),
116 &card->gendisk->part0); 116 &card->gendisk->part0);
117} 117}
118 118
@@ -120,8 +120,8 @@ static void disk_stats_complete(struct rsxx_cardinfo *card,
120 struct bio *bio, 120 struct bio *bio,
121 unsigned long start_time) 121 unsigned long start_time)
122{ 122{
123 generic_end_io_acct(bio_data_dir(bio), &card->gendisk->part0, 123 generic_end_io_acct(card->queue, bio_data_dir(bio),
124 start_time); 124 &card->gendisk->part0, start_time);
125} 125}
126 126
127static void bio_dma_done_cb(struct rsxx_cardinfo *card, 127static void bio_dma_done_cb(struct rsxx_cardinfo *card,
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 856d5dc02451..1c3383b4a0cf 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -813,9 +813,10 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
813{ 813{
814 unsigned long start_time = jiffies; 814 unsigned long start_time = jiffies;
815 int rw_acct = is_write ? REQ_OP_WRITE : REQ_OP_READ; 815 int rw_acct = is_write ? REQ_OP_WRITE : REQ_OP_READ;
816 struct request_queue *q = zram->disk->queue;
816 int ret; 817 int ret;
817 818
818 generic_start_io_acct(rw_acct, bvec->bv_len >> SECTOR_SHIFT, 819 generic_start_io_acct(q, rw_acct, bvec->bv_len >> SECTOR_SHIFT,
819 &zram->disk->part0); 820 &zram->disk->part0);
820 821
821 if (!is_write) { 822 if (!is_write) {
@@ -827,7 +828,7 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
827 ret = zram_bvec_write(zram, bvec, index, offset); 828 ret = zram_bvec_write(zram, bvec, index, offset);
828 } 829 }
829 830
830 generic_end_io_acct(rw_acct, &zram->disk->part0, start_time); 831 generic_end_io_acct(q, rw_acct, &zram->disk->part0, start_time);
831 832
832 if (unlikely(ret)) { 833 if (unlikely(ret)) {
833 if (!is_write) 834 if (!is_write)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 019b3df9f1c6..72eb97176403 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -607,7 +607,8 @@ static void request_endio(struct bio *bio)
607static void bio_complete(struct search *s) 607static void bio_complete(struct search *s)
608{ 608{
609 if (s->orig_bio) { 609 if (s->orig_bio) {
610 generic_end_io_acct(bio_data_dir(s->orig_bio), 610 struct request_queue *q = bdev_get_queue(s->orig_bio->bi_bdev);
611 generic_end_io_acct(q, bio_data_dir(s->orig_bio),
611 &s->d->disk->part0, s->start_time); 612 &s->d->disk->part0, s->start_time);
612 613
613 trace_bcache_request_end(s->d, s->orig_bio); 614 trace_bcache_request_end(s->d, s->orig_bio);
@@ -959,7 +960,7 @@ static blk_qc_t cached_dev_make_request(struct request_queue *q,
959 struct cached_dev *dc = container_of(d, struct cached_dev, disk); 960 struct cached_dev *dc = container_of(d, struct cached_dev, disk);
960 int rw = bio_data_dir(bio); 961 int rw = bio_data_dir(bio);
961 962
962 generic_start_io_acct(rw, bio_sectors(bio), &d->disk->part0); 963 generic_start_io_acct(q, rw, bio_sectors(bio), &d->disk->part0);
963 964
964 bio->bi_bdev = dc->bdev; 965 bio->bi_bdev = dc->bdev;
965 bio->bi_iter.bi_sector += dc->sb.data_offset; 966 bio->bi_iter.bi_sector += dc->sb.data_offset;
@@ -1074,7 +1075,7 @@ static blk_qc_t flash_dev_make_request(struct request_queue *q,
1074 struct bcache_device *d = bio->bi_bdev->bd_disk->private_data; 1075 struct bcache_device *d = bio->bi_bdev->bd_disk->private_data;
1075 int rw = bio_data_dir(bio); 1076 int rw = bio_data_dir(bio);
1076 1077
1077 generic_start_io_acct(rw, bio_sectors(bio), &d->disk->part0); 1078 generic_start_io_acct(q, rw, bio_sectors(bio), &d->disk->part0);
1078 1079
1079 s = search_alloc(bio, d); 1080 s = search_alloc(bio, d);
1080 cl = &s->cl; 1081 cl = &s->cl;
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 2edbcc2d7d3f..8612a2d1ccd9 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -520,7 +520,7 @@ static void start_io_acct(struct dm_io *io)
520 io->start_time = jiffies; 520 io->start_time = jiffies;
521 521
522 cpu = part_stat_lock(); 522 cpu = part_stat_lock();
523 part_round_stats(cpu, &dm_disk(md)->part0); 523 part_round_stats(md->queue, cpu, &dm_disk(md)->part0);
524 part_stat_unlock(); 524 part_stat_unlock();
525 atomic_set(&dm_disk(md)->part0.in_flight[rw], 525 atomic_set(&dm_disk(md)->part0.in_flight[rw],
526 atomic_inc_return(&md->pending[rw])); 526 atomic_inc_return(&md->pending[rw]));
@@ -539,7 +539,7 @@ static void end_io_acct(struct dm_io *io)
539 int pending; 539 int pending;
540 int rw = bio_data_dir(bio); 540 int rw = bio_data_dir(bio);
541 541
542 generic_end_io_acct(rw, &dm_disk(md)->part0, io->start_time); 542 generic_end_io_acct(md->queue, rw, &dm_disk(md)->part0, io->start_time);
543 543
544 if (unlikely(dm_stats_used(&md->stats))) 544 if (unlikely(dm_stats_used(&md->stats)))
545 dm_stats_account_io(&md->stats, bio_data_dir(bio), 545 dm_stats_account_io(&md->stats, bio_data_dir(bio),
@@ -1542,7 +1542,7 @@ static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio)
1542 1542
1543 map = dm_get_live_table(md, &srcu_idx); 1543 map = dm_get_live_table(md, &srcu_idx);
1544 1544
1545 generic_start_io_acct(rw, bio_sectors(bio), &dm_disk(md)->part0); 1545 generic_start_io_acct(q, rw, bio_sectors(bio), &dm_disk(md)->part0);
1546 1546
1547 /* if we're suspended, we have to queue this io for later */ 1547 /* if we're suspended, we have to queue this io for later */
1548 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) { 1548 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
index e1b5715bd91f..73062da3177f 100644
--- a/drivers/nvdimm/nd.h
+++ b/drivers/nvdimm/nd.h
@@ -396,7 +396,7 @@ static inline bool nd_iostat_start(struct bio *bio, unsigned long *start)
396 return false; 396 return false;
397 397
398 *start = jiffies; 398 *start = jiffies;
399 generic_start_io_acct(bio_data_dir(bio), 399 generic_start_io_acct(disk->queue, bio_data_dir(bio),
400 bio_sectors(bio), &disk->part0); 400 bio_sectors(bio), &disk->part0);
401 return true; 401 return true;
402} 402}
@@ -404,7 +404,8 @@ static inline void nd_iostat_end(struct bio *bio, unsigned long start)
404{ 404{
405 struct gendisk *disk = bio->bi_bdev->bd_disk; 405 struct gendisk *disk = bio->bi_bdev->bd_disk;
406 406
407 generic_end_io_acct(bio_data_dir(bio), &disk->part0, start); 407 generic_end_io_acct(disk->queue, bio_data_dir(bio), &disk->part0,
408 start);
408} 409}
409static inline bool is_bad_pmem(struct badblocks *bb, sector_t sector, 410static inline bool is_bad_pmem(struct badblocks *bb, sector_t sector,
410 unsigned int len) 411 unsigned int len)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7b1cf4ba0902..9276788a9b24 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -463,10 +463,11 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
463extern void bio_set_pages_dirty(struct bio *bio); 463extern void bio_set_pages_dirty(struct bio *bio);
464extern void bio_check_pages_dirty(struct bio *bio); 464extern void bio_check_pages_dirty(struct bio *bio);
465 465
466void generic_start_io_acct(int rw, unsigned long sectors, 466void generic_start_io_acct(struct request_queue *q, int rw,
467 struct hd_struct *part); 467 unsigned long sectors, struct hd_struct *part);
468void generic_end_io_acct(int rw, struct hd_struct *part, 468void generic_end_io_acct(struct request_queue *q, int rw,
469 unsigned long start_time); 469 struct hd_struct *part,
470 unsigned long start_time);
470 471
471#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 472#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
472# error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform" 473# error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform"
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e619fae2f037..7f7427e00f9c 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -362,23 +362,27 @@ static inline void free_part_stats(struct hd_struct *part)
362#define part_stat_sub(cpu, gendiskp, field, subnd) \ 362#define part_stat_sub(cpu, gendiskp, field, subnd) \
363 part_stat_add(cpu, gendiskp, field, -subnd) 363 part_stat_add(cpu, gendiskp, field, -subnd)
364 364
365static inline void part_inc_in_flight(struct hd_struct *part, int rw) 365static inline void part_inc_in_flight(struct request_queue *q,
366 struct hd_struct *part, int rw)
366{ 367{
367 atomic_inc(&part->in_flight[rw]); 368 atomic_inc(&part->in_flight[rw]);
368 if (part->partno) 369 if (part->partno)
369 atomic_inc(&part_to_disk(part)->part0.in_flight[rw]); 370 atomic_inc(&part_to_disk(part)->part0.in_flight[rw]);
370} 371}
371 372
372static inline void part_dec_in_flight(struct hd_struct *part, int rw) 373static inline void part_dec_in_flight(struct request_queue *q,
374 struct hd_struct *part, int rw)
373{ 375{
374 atomic_dec(&part->in_flight[rw]); 376 atomic_dec(&part->in_flight[rw]);
375 if (part->partno) 377 if (part->partno)
376 atomic_dec(&part_to_disk(part)->part0.in_flight[rw]); 378 atomic_dec(&part_to_disk(part)->part0.in_flight[rw]);
377} 379}
378 380
379static inline int part_in_flight(struct hd_struct *part) 381static inline int part_in_flight(struct request_queue *q,
382 struct hd_struct *part)
380{ 383{
381 return atomic_read(&part->in_flight[0]) + atomic_read(&part->in_flight[1]); 384 return atomic_read(&part->in_flight[0]) +
385 atomic_read(&part->in_flight[1]);
382} 386}
383 387
384static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) 388static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)
@@ -395,7 +399,7 @@ static inline void free_part_info(struct hd_struct *part)
395} 399}
396 400
397/* block/blk-core.c */ 401/* block/blk-core.c */
398extern void part_round_stats(int cpu, struct hd_struct *part); 402extern void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part);
399 403
400/* block/genhd.c */ 404/* block/genhd.c */
401extern void device_add_disk(struct device *parent, struct gendisk *disk); 405extern void device_add_disk(struct device *parent, struct gendisk *disk);