aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2011-03-01 15:04:39 -0500
committerJens Axboe <jaxboe@fusionio.com>2011-03-01 15:04:39 -0500
commit6fae9c25134baffbeeb20031479e7ff6f6d8eec0 (patch)
treec9ab89992ce5293a43cd455a81dc8a5926a28a5e /block/blk-core.c
parentc186794dbb466b45cf40f942f2d09d6d5b4b0e42 (diff)
parentf5412be599602124d2bdd49947b231dd77c0bf99 (diff)
Merge commit 'v2.6.38-rc6' into for-2.6.39/core
Conflicts: block/cfq-iosched.c Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index ab4a7696956d..3cc17e6064d6 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -33,7 +33,7 @@
33 33
34#include "blk.h" 34#include "blk.h"
35 35
36EXPORT_TRACEPOINT_SYMBOL_GPL(block_remap); 36EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_remap);
37EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); 37EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap);
38EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); 38EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete);
39 39
@@ -64,13 +64,27 @@ static void drive_stat_acct(struct request *rq, int new_io)
64 return; 64 return;
65 65
66 cpu = part_stat_lock(); 66 cpu = part_stat_lock();
67 part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));
68 67
69 if (!new_io) 68 if (!new_io) {
69 part = rq->part;
70 part_stat_inc(cpu, part, merges[rw]); 70 part_stat_inc(cpu, part, merges[rw]);
71 else { 71 } else {
72 part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));
73 if (!hd_struct_try_get(part)) {
74 /*
75 * The partition is already being removed,
76 * the request will be accounted on the disk only
77 *
78 * We take a reference on disk->part0 although that
79 * partition will never be deleted, so we can treat
80 * it as any other partition.
81 */
82 part = &rq->rq_disk->part0;
83 hd_struct_get(part);
84 }
72 part_round_stats(cpu, part); 85 part_round_stats(cpu, part);
73 part_inc_in_flight(part, rw); 86 part_inc_in_flight(part, rw);
87 rq->part = part;
74 } 88 }
75 89
76 part_stat_unlock(); 90 part_stat_unlock();
@@ -128,6 +142,7 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
128 rq->ref_count = 1; 142 rq->ref_count = 1;
129 rq->start_time = jiffies; 143 rq->start_time = jiffies;
130 set_start_time_ns(rq); 144 set_start_time_ns(rq);
145 rq->part = NULL;
131} 146}
132EXPORT_SYMBOL(blk_rq_init); 147EXPORT_SYMBOL(blk_rq_init);
133 148
@@ -1342,9 +1357,9 @@ static inline void blk_partition_remap(struct bio *bio)
1342 bio->bi_sector += p->start_sect; 1357 bio->bi_sector += p->start_sect;
1343 bio->bi_bdev = bdev->bd_contains; 1358 bio->bi_bdev = bdev->bd_contains;
1344 1359
1345 trace_block_remap(bdev_get_queue(bio->bi_bdev), bio, 1360 trace_block_bio_remap(bdev_get_queue(bio->bi_bdev), bio,
1346 bdev->bd_dev, 1361 bdev->bd_dev,
1347 bio->bi_sector - p->start_sect); 1362 bio->bi_sector - p->start_sect);
1348 } 1363 }
1349} 1364}
1350 1365
@@ -1513,7 +1528,7 @@ static inline void __generic_make_request(struct bio *bio)
1513 goto end_io; 1528 goto end_io;
1514 1529
1515 if (old_sector != -1) 1530 if (old_sector != -1)
1516 trace_block_remap(q, bio, old_dev, old_sector); 1531 trace_block_bio_remap(q, bio, old_dev, old_sector);
1517 1532
1518 old_sector = bio->bi_sector; 1533 old_sector = bio->bi_sector;
1519 old_dev = bio->bi_bdev->bd_dev; 1534 old_dev = bio->bi_bdev->bd_dev;
@@ -1789,7 +1804,7 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes)
1789 int cpu; 1804 int cpu;
1790 1805
1791 cpu = part_stat_lock(); 1806 cpu = part_stat_lock();
1792 part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); 1807 part = req->part;
1793 part_stat_add(cpu, part, sectors[rw], bytes >> 9); 1808 part_stat_add(cpu, part, sectors[rw], bytes >> 9);
1794 part_stat_unlock(); 1809 part_stat_unlock();
1795 } 1810 }
@@ -1809,13 +1824,14 @@ static void blk_account_io_done(struct request *req)
1809 int cpu; 1824 int cpu;
1810 1825
1811 cpu = part_stat_lock(); 1826 cpu = part_stat_lock();
1812 part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); 1827 part = req->part;
1813 1828
1814 part_stat_inc(cpu, part, ios[rw]); 1829 part_stat_inc(cpu, part, ios[rw]);
1815 part_stat_add(cpu, part, ticks[rw], duration); 1830 part_stat_add(cpu, part, ticks[rw], duration);
1816 part_round_stats(cpu, part); 1831 part_round_stats(cpu, part);
1817 part_dec_in_flight(part, rw); 1832 part_dec_in_flight(part, rw);
1818 1833
1834 hd_struct_put(part);
1819 part_stat_unlock(); 1835 part_stat_unlock();
1820 } 1836 }
1821} 1837}
@@ -2619,7 +2635,9 @@ int __init blk_dev_init(void)
2619 BUILD_BUG_ON(__REQ_NR_BITS > 8 * 2635 BUILD_BUG_ON(__REQ_NR_BITS > 8 *
2620 sizeof(((struct request *)0)->cmd_flags)); 2636 sizeof(((struct request *)0)->cmd_flags));
2621 2637
2622 kblockd_workqueue = create_workqueue("kblockd"); 2638 /* used for unplugging and affects IO latency/throughput - HIGHPRI */
2639 kblockd_workqueue = alloc_workqueue("kblockd",
2640 WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
2623 if (!kblockd_workqueue) 2641 if (!kblockd_workqueue)
2624 panic("Failed to create kblockd\n"); 2642 panic("Failed to create kblockd\n");
2625 2643