aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/Kconfig3
-rw-r--r--block/blk-barrier.c1
-rw-r--r--block/blk-cgroup.c1
-rw-r--r--block/blk-integrity.c1
-rw-r--r--block/blk-ioc.c1
-rw-r--r--block/blk-settings.c12
-rw-r--r--block/blk-sysfs.c26
-rw-r--r--block/blk-tag.c1
-rw-r--r--block/bsg.c1
-rw-r--r--block/cfq-iosched.c42
-rw-r--r--block/compat_ioctl.c1
-rw-r--r--block/elevator.c2
-rw-r--r--block/ioctl.c1
-rw-r--r--block/noop-iosched.c1
14 files changed, 72 insertions, 22 deletions
diff --git a/block/Kconfig b/block/Kconfig
index 62a5921321cd..f9e89f4d94bb 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -78,8 +78,9 @@ config BLK_DEV_INTEGRITY
78 Protection. If in doubt, say N. 78 Protection. If in doubt, say N.
79 79
80config BLK_CGROUP 80config BLK_CGROUP
81 tristate 81 tristate "Block cgroup support"
82 depends on CGROUPS 82 depends on CGROUPS
83 depends on CFQ_GROUP_IOSCHED
83 default n 84 default n
84 ---help--- 85 ---help---
85 Generic block IO controller cgroup interface. This is the common 86 Generic block IO controller cgroup interface. This is the common
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index 8618d8996fea..6d88544b677f 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -5,6 +5,7 @@
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/bio.h> 6#include <linux/bio.h>
7#include <linux/blkdev.h> 7#include <linux/blkdev.h>
8#include <linux/gfp.h>
8 9
9#include "blk.h" 10#include "blk.h"
10 11
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 4b686ad08eaa..5fe03def34b2 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -15,6 +15,7 @@
15#include <linux/kdev_t.h> 15#include <linux/kdev_t.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/slab.h>
18#include "blk-cgroup.h" 19#include "blk-cgroup.h"
19 20
20static DEFINE_SPINLOCK(blkio_list_lock); 21static DEFINE_SPINLOCK(blkio_list_lock);
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 96e83c2bdb94..edce1ef7933d 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -24,6 +24,7 @@
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/bio.h> 25#include <linux/bio.h>
26#include <linux/scatterlist.h> 26#include <linux/scatterlist.h>
27#include <linux/slab.h>
27 28
28#include "blk.h" 29#include "blk.h"
29 30
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 3f65c8aadb2f..d22c4c55c406 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -7,6 +7,7 @@
7#include <linux/bio.h> 7#include <linux/bio.h>
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/bootmem.h> /* for max_pfn/max_low_pfn */ 9#include <linux/bootmem.h> /* for max_pfn/max_low_pfn */
10#include <linux/slab.h>
10 11
11#include "blk.h" 12#include "blk.h"
12 13
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 31e7a9375c13..f5ed5a1187ba 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -8,7 +8,9 @@
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/bootmem.h> /* for max_pfn/max_low_pfn */ 9#include <linux/bootmem.h> /* for max_pfn/max_low_pfn */
10#include <linux/gcd.h> 10#include <linux/gcd.h>
11#include <linux/lcm.h>
11#include <linux/jiffies.h> 12#include <linux/jiffies.h>
13#include <linux/gfp.h>
12 14
13#include "blk.h" 15#include "blk.h"
14 16
@@ -461,16 +463,6 @@ void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
461} 463}
462EXPORT_SYMBOL(blk_queue_stack_limits); 464EXPORT_SYMBOL(blk_queue_stack_limits);
463 465
464static unsigned int lcm(unsigned int a, unsigned int b)
465{
466 if (a && b)
467 return (a * b) / gcd(a, b);
468 else if (b)
469 return b;
470
471 return a;
472}
473
474/** 466/**
475 * blk_stack_limits - adjust queue_limits for stacked devices 467 * blk_stack_limits - adjust queue_limits for stacked devices
476 * @t: the stacking driver limits (top device) 468 * @t: the stacking driver limits (top device)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 2ae2cb3f362f..306759bbdf1b 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -2,6 +2,7 @@
2 * Functions related to sysfs handling 2 * Functions related to sysfs handling
3 */ 3 */
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/slab.h>
5#include <linux/module.h> 6#include <linux/module.h>
6#include <linux/bio.h> 7#include <linux/bio.h>
7#include <linux/blkdev.h> 8#include <linux/blkdev.h>
@@ -106,6 +107,19 @@ static ssize_t queue_max_sectors_show(struct request_queue *q, char *page)
106 return queue_var_show(max_sectors_kb, (page)); 107 return queue_var_show(max_sectors_kb, (page));
107} 108}
108 109
110static ssize_t queue_max_segments_show(struct request_queue *q, char *page)
111{
112 return queue_var_show(queue_max_segments(q), (page));
113}
114
115static ssize_t queue_max_segment_size_show(struct request_queue *q, char *page)
116{
117 if (test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags))
118 return queue_var_show(queue_max_segment_size(q), (page));
119
120 return queue_var_show(PAGE_CACHE_SIZE, (page));
121}
122
109static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page) 123static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page)
110{ 124{
111 return queue_var_show(queue_logical_block_size(q), page); 125 return queue_var_show(queue_logical_block_size(q), page);
@@ -280,6 +294,16 @@ static struct queue_sysfs_entry queue_max_hw_sectors_entry = {
280 .show = queue_max_hw_sectors_show, 294 .show = queue_max_hw_sectors_show,
281}; 295};
282 296
297static struct queue_sysfs_entry queue_max_segments_entry = {
298 .attr = {.name = "max_segments", .mode = S_IRUGO },
299 .show = queue_max_segments_show,
300};
301
302static struct queue_sysfs_entry queue_max_segment_size_entry = {
303 .attr = {.name = "max_segment_size", .mode = S_IRUGO },
304 .show = queue_max_segment_size_show,
305};
306
283static struct queue_sysfs_entry queue_iosched_entry = { 307static struct queue_sysfs_entry queue_iosched_entry = {
284 .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR }, 308 .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR },
285 .show = elv_iosched_show, 309 .show = elv_iosched_show,
@@ -355,6 +379,8 @@ static struct attribute *default_attrs[] = {
355 &queue_ra_entry.attr, 379 &queue_ra_entry.attr,
356 &queue_max_hw_sectors_entry.attr, 380 &queue_max_hw_sectors_entry.attr,
357 &queue_max_sectors_entry.attr, 381 &queue_max_sectors_entry.attr,
382 &queue_max_segments_entry.attr,
383 &queue_max_segment_size_entry.attr,
358 &queue_iosched_entry.attr, 384 &queue_iosched_entry.attr,
359 &queue_hw_sector_size_entry.attr, 385 &queue_hw_sector_size_entry.attr,
360 &queue_logical_block_size_entry.attr, 386 &queue_logical_block_size_entry.attr,
diff --git a/block/blk-tag.c b/block/blk-tag.c
index 6b0f52c20964..ece65fc4c79b 100644
--- a/block/blk-tag.c
+++ b/block/blk-tag.c
@@ -5,6 +5,7 @@
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/bio.h> 6#include <linux/bio.h>
7#include <linux/blkdev.h> 7#include <linux/blkdev.h>
8#include <linux/slab.h>
8 9
9#include "blk.h" 10#include "blk.h"
10 11
diff --git a/block/bsg.c b/block/bsg.c
index 46597a6bd112..82d58829ba59 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -21,6 +21,7 @@
21#include <linux/idr.h> 21#include <linux/idr.h>
22#include <linux/bsg.h> 22#include <linux/bsg.h>
23#include <linux/smp_lock.h> 23#include <linux/smp_lock.h>
24#include <linux/slab.h>
24 25
25#include <scsi/scsi.h> 26#include <scsi/scsi.h>
26#include <scsi/scsi_ioctl.h> 27#include <scsi/scsi_ioctl.h>
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index dee9d9378fee..838834be115b 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -7,6 +7,7 @@
7 * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk> 7 * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
8 */ 8 */
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/slab.h>
10#include <linux/blkdev.h> 11#include <linux/blkdev.h>
11#include <linux/elevator.h> 12#include <linux/elevator.h>
12#include <linux/jiffies.h> 13#include <linux/jiffies.h>
@@ -47,6 +48,7 @@ static const int cfq_hist_divisor = 4;
47#define CFQ_SERVICE_SHIFT 12 48#define CFQ_SERVICE_SHIFT 12
48 49
49#define CFQQ_SEEK_THR (sector_t)(8 * 100) 50#define CFQQ_SEEK_THR (sector_t)(8 * 100)
51#define CFQQ_CLOSE_THR (sector_t)(8 * 1024)
50#define CFQQ_SECT_THR_NONROT (sector_t)(2 * 32) 52#define CFQQ_SECT_THR_NONROT (sector_t)(2 * 32)
51#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8) 53#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8)
52 54
@@ -947,6 +949,11 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
947 unsigned int major, minor; 949 unsigned int major, minor;
948 950
949 cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key)); 951 cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key));
952 if (cfqg && !cfqg->blkg.dev && bdi->dev && dev_name(bdi->dev)) {
953 sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
954 cfqg->blkg.dev = MKDEV(major, minor);
955 goto done;
956 }
950 if (cfqg || !create) 957 if (cfqg || !create)
951 goto done; 958 goto done;
952 959
@@ -1517,7 +1524,8 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd,
1517 struct cfq_queue *cfqq) 1524 struct cfq_queue *cfqq)
1518{ 1525{
1519 if (cfqq) { 1526 if (cfqq) {
1520 cfq_log_cfqq(cfqd, cfqq, "set_active"); 1527 cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d",
1528 cfqd->serving_prio, cfqd->serving_type);
1521 cfqq->slice_start = 0; 1529 cfqq->slice_start = 0;
1522 cfqq->dispatch_start = jiffies; 1530 cfqq->dispatch_start = jiffies;
1523 cfqq->allocated_slice = 0; 1531 cfqq->allocated_slice = 0;
@@ -1660,9 +1668,9 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
1660} 1668}
1661 1669
1662static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, 1670static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1663 struct request *rq, bool for_preempt) 1671 struct request *rq)
1664{ 1672{
1665 return cfq_dist_from_last(cfqd, rq) <= CFQQ_SEEK_THR; 1673 return cfq_dist_from_last(cfqd, rq) <= CFQQ_CLOSE_THR;
1666} 1674}
1667 1675
1668static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, 1676static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
@@ -1689,7 +1697,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1689 * will contain the closest sector. 1697 * will contain the closest sector.
1690 */ 1698 */
1691 __cfqq = rb_entry(parent, struct cfq_queue, p_node); 1699 __cfqq = rb_entry(parent, struct cfq_queue, p_node);
1692 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) 1700 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq))
1693 return __cfqq; 1701 return __cfqq;
1694 1702
1695 if (blk_rq_pos(__cfqq->next_rq) < sector) 1703 if (blk_rq_pos(__cfqq->next_rq) < sector)
@@ -1700,7 +1708,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1700 return NULL; 1708 return NULL;
1701 1709
1702 __cfqq = rb_entry(node, struct cfq_queue, p_node); 1710 __cfqq = rb_entry(node, struct cfq_queue, p_node);
1703 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) 1711 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq))
1704 return __cfqq; 1712 return __cfqq;
1705 1713
1706 return NULL; 1714 return NULL;
@@ -1721,6 +1729,8 @@ static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd,
1721{ 1729{
1722 struct cfq_queue *cfqq; 1730 struct cfq_queue *cfqq;
1723 1731
1732 if (cfq_class_idle(cur_cfqq))
1733 return NULL;
1724 if (!cfq_cfqq_sync(cur_cfqq)) 1734 if (!cfq_cfqq_sync(cur_cfqq))
1725 return NULL; 1735 return NULL;
1726 if (CFQQ_SEEKY(cur_cfqq)) 1736 if (CFQQ_SEEKY(cur_cfqq))
@@ -1787,7 +1797,11 @@ static bool cfq_should_idle(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1787 * Otherwise, we do only if they are the last ones 1797 * Otherwise, we do only if they are the last ones
1788 * in their service tree. 1798 * in their service tree.
1789 */ 1799 */
1790 return service_tree->count == 1 && cfq_cfqq_sync(cfqq); 1800 if (service_tree->count == 1 && cfq_cfqq_sync(cfqq))
1801 return 1;
1802 cfq_log_cfqq(cfqd, cfqq, "Not idling. st->count:%d",
1803 service_tree->count);
1804 return 0;
1791} 1805}
1792 1806
1793static void cfq_arm_slice_timer(struct cfq_data *cfqd) 1807static void cfq_arm_slice_timer(struct cfq_data *cfqd)
@@ -1832,8 +1846,11 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
1832 * time slice. 1846 * time slice.
1833 */ 1847 */
1834 if (sample_valid(cic->ttime_samples) && 1848 if (sample_valid(cic->ttime_samples) &&
1835 (cfqq->slice_end - jiffies < cic->ttime_mean)) 1849 (cfqq->slice_end - jiffies < cic->ttime_mean)) {
1850 cfq_log_cfqq(cfqd, cfqq, "Not idling. think_time:%d",
1851 cic->ttime_mean);
1836 return; 1852 return;
1853 }
1837 1854
1838 cfq_mark_cfqq_wait_request(cfqq); 1855 cfq_mark_cfqq_wait_request(cfqq);
1839 1856
@@ -2041,6 +2058,7 @@ static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg)
2041 slice = max(slice, 2 * cfqd->cfq_slice_idle); 2058 slice = max(slice, 2 * cfqd->cfq_slice_idle);
2042 2059
2043 slice = max_t(unsigned, slice, CFQ_MIN_TT); 2060 slice = max_t(unsigned, slice, CFQ_MIN_TT);
2061 cfq_log(cfqd, "workload slice:%d", slice);
2044 cfqd->workload_expires = jiffies + slice; 2062 cfqd->workload_expires = jiffies + slice;
2045 cfqd->noidle_tree_requires_idle = false; 2063 cfqd->noidle_tree_requires_idle = false;
2046} 2064}
@@ -2188,10 +2206,13 @@ static int cfq_forced_dispatch(struct cfq_data *cfqd)
2188 struct cfq_queue *cfqq; 2206 struct cfq_queue *cfqq;
2189 int dispatched = 0; 2207 int dispatched = 0;
2190 2208
2191 while ((cfqq = cfq_get_next_queue_forced(cfqd)) != NULL) 2209 /* Expire the timeslice of the current active queue first */
2210 cfq_slice_expired(cfqd, 0);
2211 while ((cfqq = cfq_get_next_queue_forced(cfqd)) != NULL) {
2212 __cfq_set_active_queue(cfqd, cfqq);
2192 dispatched += __cfq_forced_dispatch_cfqq(cfqq); 2213 dispatched += __cfq_forced_dispatch_cfqq(cfqq);
2214 }
2193 2215
2194 cfq_slice_expired(cfqd, 0);
2195 BUG_ON(cfqd->busy_queues); 2216 BUG_ON(cfqd->busy_queues);
2196 2217
2197 cfq_log(cfqd, "forced_dispatch=%d", dispatched); 2218 cfq_log(cfqd, "forced_dispatch=%d", dispatched);
@@ -3103,7 +3124,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
3103 * if this request is as-good as one we would expect from the 3124 * if this request is as-good as one we would expect from the
3104 * current cfqq, let it preempt 3125 * current cfqq, let it preempt
3105 */ 3126 */
3106 if (cfq_rq_close(cfqd, cfqq, rq, true)) 3127 if (cfq_rq_close(cfqd, cfqq, rq))
3107 return true; 3128 return true;
3108 3129
3109 return false; 3130 return false;
@@ -3307,6 +3328,7 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
3307 if (cfq_should_wait_busy(cfqd, cfqq)) { 3328 if (cfq_should_wait_busy(cfqd, cfqq)) {
3308 cfqq->slice_end = jiffies + cfqd->cfq_slice_idle; 3329 cfqq->slice_end = jiffies + cfqd->cfq_slice_idle;
3309 cfq_mark_cfqq_wait_busy(cfqq); 3330 cfq_mark_cfqq_wait_busy(cfqq);
3331 cfq_log_cfqq(cfqd, cfqq, "will busy wait");
3310 } 3332 }
3311 3333
3312 /* 3334 /*
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index 4eb8e9ea4af5..f26051f44681 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -6,6 +6,7 @@
6#include <linux/elevator.h> 6#include <linux/elevator.h>
7#include <linux/fd.h> 7#include <linux/fd.h>
8#include <linux/hdreg.h> 8#include <linux/hdreg.h>
9#include <linux/slab.h>
9#include <linux/syscalls.h> 10#include <linux/syscalls.h>
10#include <linux/smp_lock.h> 11#include <linux/smp_lock.h>
11#include <linux/types.h> 12#include <linux/types.h>
diff --git a/block/elevator.c b/block/elevator.c
index df75676f6671..76e3702d5381 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -154,7 +154,7 @@ static struct elevator_type *elevator_get(const char *name)
154 154
155 spin_unlock(&elv_list_lock); 155 spin_unlock(&elv_list_lock);
156 156
157 sprintf(elv, "%s-iosched", name); 157 snprintf(elv, sizeof(elv), "%s-iosched", name);
158 158
159 request_module("%s", elv); 159 request_module("%s", elv);
160 spin_lock(&elv_list_lock); 160 spin_lock(&elv_list_lock);
diff --git a/block/ioctl.c b/block/ioctl.c
index be48ea51faee..8905d2a2a717 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -1,5 +1,6 @@
1#include <linux/capability.h> 1#include <linux/capability.h>
2#include <linux/blkdev.h> 2#include <linux/blkdev.h>
3#include <linux/gfp.h>
3#include <linux/blkpg.h> 4#include <linux/blkpg.h>
4#include <linux/hdreg.h> 5#include <linux/hdreg.h>
5#include <linux/backing-dev.h> 6#include <linux/backing-dev.h>
diff --git a/block/noop-iosched.c b/block/noop-iosched.c
index 3a0d369d08c7..232c4b38cd37 100644
--- a/block/noop-iosched.c
+++ b/block/noop-iosched.c
@@ -5,6 +5,7 @@
5#include <linux/elevator.h> 5#include <linux/elevator.h>
6#include <linux/bio.h> 6#include <linux/bio.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/slab.h>
8#include <linux/init.h> 9#include <linux/init.h>
9 10
10struct noop_data { 11struct noop_data {