aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2013-11-08 11:08:12 -0500
committerJens Axboe <axboe@kernel.dk>2013-11-08 11:08:12 -0500
commite37459b8e2c7db6735e39e019e448b76e5e77647 (patch)
treea3f0944db87a8ae0d41e5acbbbabc1e7ef534d1b
parentc7d1ba417c7cb7297d14dd47a390ec90ce548d5c (diff)
parente7e245000110a7794de8f925b9edc06a9c852f80 (diff)
Merge branch 'blk-mq/core' into for-3.13/core
Signed-off-by: Jens Axboe <axboe@kernel.dk> Conflicts: block/blk-timeout.c
-rw-r--r--block/Makefile5
-rw-r--r--block/blk-core.c157
-rw-r--r--block/blk-exec.c14
-rw-r--r--block/blk-flush.c154
-rw-r--r--block/blk-merge.c17
-rw-r--r--block/blk-mq-cpu.c93
-rw-r--r--block/blk-mq-cpumap.c108
-rw-r--r--block/blk-mq-sysfs.c384
-rw-r--r--block/blk-mq-tag.c204
-rw-r--r--block/blk-mq-tag.h27
-rw-r--r--block/blk-mq.c1500
-rw-r--r--block/blk-mq.h52
-rw-r--r--block/blk-sysfs.c13
-rw-r--r--block/blk-timeout.c74
-rw-r--r--block/blk.h17
-rw-r--r--drivers/block/Kconfig3
-rw-r--r--drivers/block/Makefile1
-rw-r--r--drivers/block/floppy.c4
-rw-r--r--drivers/block/null_blk.c635
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/blk-mq.h183
-rw-r--r--include/linux/blk_types.h68
-rw-r--r--include/linux/blkdev.h60
-rw-r--r--include/linux/percpu_ida.h23
-rw-r--r--kernel/smp.c7
-rw-r--r--lib/percpu_counter.c15
-rw-r--r--lib/percpu_ida.c89
28 files changed, 3721 insertions, 190 deletions
diff --git a/block/Makefile b/block/Makefile
index 671a83d063a5..20645e88fb57 100644
--- a/block/Makefile
+++ b/block/Makefile
@@ -5,8 +5,9 @@
5obj-$(CONFIG_BLOCK) := elevator.o blk-core.o blk-tag.o blk-sysfs.o \ 5obj-$(CONFIG_BLOCK) := elevator.o blk-core.o blk-tag.o blk-sysfs.o \
6 blk-flush.o blk-settings.o blk-ioc.o blk-map.o \ 6 blk-flush.o blk-settings.o blk-ioc.o blk-map.o \
7 blk-exec.o blk-merge.o blk-softirq.o blk-timeout.o \ 7 blk-exec.o blk-merge.o blk-softirq.o blk-timeout.o \
8 blk-iopoll.o blk-lib.o ioctl.o genhd.o scsi_ioctl.o \ 8 blk-iopoll.o blk-lib.o blk-mq.o blk-mq-tag.o \
9 partition-generic.o partitions/ 9 blk-mq-sysfs.o blk-mq-cpu.o blk-mq-cpumap.o ioctl.o \
10 genhd.o scsi_ioctl.o partition-generic.o partitions/
10 11
11obj-$(CONFIG_BLK_DEV_BSG) += bsg.o 12obj-$(CONFIG_BLK_DEV_BSG) += bsg.o
12obj-$(CONFIG_BLK_DEV_BSGLIB) += bsg-lib.o 13obj-$(CONFIG_BLK_DEV_BSGLIB) += bsg-lib.o
diff --git a/block/blk-core.c b/block/blk-core.c
index 25f13479f552..8bdd0121212a 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -16,6 +16,7 @@
16#include <linux/backing-dev.h> 16#include <linux/backing-dev.h>
17#include <linux/bio.h> 17#include <linux/bio.h>
18#include <linux/blkdev.h> 18#include <linux/blkdev.h>
19#include <linux/blk-mq.h>
19#include <linux/highmem.h> 20#include <linux/highmem.h>
20#include <linux/mm.h> 21#include <linux/mm.h>
21#include <linux/kernel_stat.h> 22#include <linux/kernel_stat.h>
@@ -48,7 +49,7 @@ DEFINE_IDA(blk_queue_ida);
48/* 49/*
49 * For the allocated request tables 50 * For the allocated request tables
50 */ 51 */
51static struct kmem_cache *request_cachep; 52struct kmem_cache *request_cachep = NULL;
52 53
53/* 54/*
54 * For queue allocation 55 * For queue allocation
@@ -60,42 +61,6 @@ struct kmem_cache *blk_requestq_cachep;
60 */ 61 */
61static struct workqueue_struct *kblockd_workqueue; 62static struct workqueue_struct *kblockd_workqueue;
62 63
63static void drive_stat_acct(struct request *rq, int new_io)
64{
65 struct hd_struct *part;
66 int rw = rq_data_dir(rq);
67 int cpu;
68
69 if (!blk_do_io_stat(rq))
70 return;
71
72 cpu = part_stat_lock();
73
74 if (!new_io) {
75 part = rq->part;
76 part_stat_inc(cpu, part, merges[rw]);
77 } else {
78 part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));
79 if (!hd_struct_try_get(part)) {
80 /*
81 * The partition is already being removed,
82 * the request will be accounted on the disk only
83 *
84 * We take a reference on disk->part0 although that
85 * partition will never be deleted, so we can treat
86 * it as any other partition.
87 */
88 part = &rq->rq_disk->part0;
89 hd_struct_get(part);
90 }
91 part_round_stats(cpu, part);
92 part_inc_in_flight(part, rw);
93 rq->part = part;
94 }
95
96 part_stat_unlock();
97}
98
99void blk_queue_congestion_threshold(struct request_queue *q) 64void blk_queue_congestion_threshold(struct request_queue *q)
100{ 65{
101 int nr; 66 int nr;
@@ -145,7 +110,6 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
145 rq->cmd = rq->__cmd; 110 rq->cmd = rq->__cmd;
146 rq->cmd_len = BLK_MAX_CDB; 111 rq->cmd_len = BLK_MAX_CDB;
147 rq->tag = -1; 112 rq->tag = -1;
148 rq->ref_count = 1;
149 rq->start_time = jiffies; 113 rq->start_time = jiffies;
150 set_start_time_ns(rq); 114 set_start_time_ns(rq);
151 rq->part = NULL; 115 rq->part = NULL;
@@ -174,9 +138,9 @@ void blk_dump_rq_flags(struct request *rq, char *msg)
174{ 138{
175 int bit; 139 int bit;
176 140
177 printk(KERN_INFO "%s: dev %s: type=%x, flags=%x\n", msg, 141 printk(KERN_INFO "%s: dev %s: type=%x, flags=%llx\n", msg,
178 rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->cmd_type, 142 rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->cmd_type,
179 rq->cmd_flags); 143 (unsigned long long) rq->cmd_flags);
180 144
181 printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n", 145 printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n",
182 (unsigned long long)blk_rq_pos(rq), 146 (unsigned long long)blk_rq_pos(rq),
@@ -595,9 +559,12 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
595 if (!q) 559 if (!q)
596 return NULL; 560 return NULL;
597 561
562 if (percpu_counter_init(&q->mq_usage_counter, 0))
563 goto fail_q;
564
598 q->id = ida_simple_get(&blk_queue_ida, 0, 0, gfp_mask); 565 q->id = ida_simple_get(&blk_queue_ida, 0, 0, gfp_mask);
599 if (q->id < 0) 566 if (q->id < 0)
600 goto fail_q; 567 goto fail_c;
601 568
602 q->backing_dev_info.ra_pages = 569 q->backing_dev_info.ra_pages =
603 (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; 570 (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
@@ -644,6 +611,8 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
644 q->bypass_depth = 1; 611 q->bypass_depth = 1;
645 __set_bit(QUEUE_FLAG_BYPASS, &q->queue_flags); 612 __set_bit(QUEUE_FLAG_BYPASS, &q->queue_flags);
646 613
614 init_waitqueue_head(&q->mq_freeze_wq);
615
647 if (blkcg_init_queue(q)) 616 if (blkcg_init_queue(q))
648 goto fail_bdi; 617 goto fail_bdi;
649 618
@@ -653,6 +622,8 @@ fail_bdi:
653 bdi_destroy(&q->backing_dev_info); 622 bdi_destroy(&q->backing_dev_info);
654fail_id: 623fail_id:
655 ida_simple_remove(&blk_queue_ida, q->id); 624 ida_simple_remove(&blk_queue_ida, q->id);
625fail_c:
626 percpu_counter_destroy(&q->mq_usage_counter);
656fail_q: 627fail_q:
657 kmem_cache_free(blk_requestq_cachep, q); 628 kmem_cache_free(blk_requestq_cachep, q);
658 return NULL; 629 return NULL;
@@ -1119,7 +1090,8 @@ retry:
1119 goto retry; 1090 goto retry;
1120} 1091}
1121 1092
1122struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask) 1093static struct request *blk_old_get_request(struct request_queue *q, int rw,
1094 gfp_t gfp_mask)
1123{ 1095{
1124 struct request *rq; 1096 struct request *rq;
1125 10