aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/Kconfig3
-rw-r--r--block/blk-settings.c11
-rw-r--r--block/blk-sysfs.c25
-rw-r--r--block/cfq-iosched.c11
4 files changed, 34 insertions, 16 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-settings.c b/block/blk-settings.c
index 31e7a9375c13..4c4700dca56a 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -8,6 +8,7 @@
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>
12 13
13#include "blk.h" 14#include "blk.h"
@@ -461,16 +462,6 @@ void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
461} 462}
462EXPORT_SYMBOL(blk_queue_stack_limits); 463EXPORT_SYMBOL(blk_queue_stack_limits);
463 464
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/** 465/**
475 * blk_stack_limits - adjust queue_limits for stacked devices 466 * blk_stack_limits - adjust queue_limits for stacked devices
476 * @t: the stacking driver limits (top device) 467 * @t: the stacking driver limits (top device)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 2ae2cb3f362f..4426739fb757 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -106,6 +106,19 @@ static ssize_t queue_max_sectors_show(struct request_queue *q, char *page)
106 return queue_var_show(max_sectors_kb, (page)); 106 return queue_var_show(max_sectors_kb, (page));
107} 107}
108 108
109static ssize_t queue_max_segments_show(struct request_queue *q, char *page)
110{
111 return queue_var_show(queue_max_segments(q), (page));
112}
113
114static ssize_t queue_max_segment_size_show(struct request_queue *q, char *page)
115{
116 if (test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags))
117 return queue_var_show(queue_max_segment_size(q), (page));
118
119 return queue_var_show(PAGE_CACHE_SIZE, (page));
120}
121
109static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page) 122static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page)
110{ 123{
111 return queue_var_show(queue_logical_block_size(q), page); 124 return queue_var_show(queue_logical_block_size(q), page);
@@ -280,6 +293,16 @@ static struct queue_sysfs_entry queue_max_hw_sectors_entry = {
280 .show = queue_max_hw_sectors_show, 293 .show = queue_max_hw_sectors_show,
281}; 294};
282 295
296static struct queue_sysfs_entry queue_max_segments_entry = {
297 .attr = {.name = "max_segments", .mode = S_IRUGO },
298 .show = queue_max_segments_show,
299};
300
301static struct queue_sysfs_entry queue_max_segment_size_entry = {
302 .attr = {.name = "max_segment_size", .mode = S_IRUGO },
303 .show = queue_max_segment_size_show,
304};
305
283static struct queue_sysfs_entry queue_iosched_entry = { 306static struct queue_sysfs_entry queue_iosched_entry = {
284 .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR }, 307 .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR },
285 .show = elv_iosched_show, 308 .show = elv_iosched_show,
@@ -355,6 +378,8 @@ static struct attribute *default_attrs[] = {
355 &queue_ra_entry.attr, 378 &queue_ra_entry.attr,
356 &queue_max_hw_sectors_entry.attr, 379 &queue_max_hw_sectors_entry.attr,
357 &queue_max_sectors_entry.attr, 380 &queue_max_sectors_entry.attr,
381 &queue_max_segments_entry.attr,
382 &queue_max_segment_size_entry.attr,
358 &queue_iosched_entry.attr, 383 &queue_iosched_entry.attr,
359 &queue_hw_sector_size_entry.attr, 384 &queue_hw_sector_size_entry.attr,
360 &queue_logical_block_size_entry.attr, 385 &queue_logical_block_size_entry.attr,
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index dee9d9378fee..8d5a2f2f7fb9 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -47,6 +47,7 @@ static const int cfq_hist_divisor = 4;
47#define CFQ_SERVICE_SHIFT 12 47#define CFQ_SERVICE_SHIFT 12
48 48
49#define CFQQ_SEEK_THR (sector_t)(8 * 100) 49#define CFQQ_SEEK_THR (sector_t)(8 * 100)
50#define CFQQ_CLOSE_THR (sector_t)(8 * 1024)
50#define CFQQ_SECT_THR_NONROT (sector_t)(2 * 32) 51#define CFQQ_SECT_THR_NONROT (sector_t)(2 * 32)
51#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8) 52#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8)
52 53
@@ -1660,9 +1661,9 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
1660} 1661}
1661 1662
1662static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, 1663static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1663 struct request *rq, bool for_preempt) 1664 struct request *rq)
1664{ 1665{
1665 return cfq_dist_from_last(cfqd, rq) <= CFQQ_SEEK_THR; 1666 return cfq_dist_from_last(cfqd, rq) <= CFQQ_CLOSE_THR;
1666} 1667}
1667 1668
1668static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, 1669static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
@@ -1689,7 +1690,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1689 * will contain the closest sector. 1690 * will contain the closest sector.
1690 */ 1691 */
1691 __cfqq = rb_entry(parent, struct cfq_queue, p_node); 1692 __cfqq = rb_entry(parent, struct cfq_queue, p_node);
1692 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) 1693 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq))
1693 return __cfqq; 1694 return __cfqq;
1694 1695
1695 if (blk_rq_pos(__cfqq->next_rq) < sector) 1696 if (blk_rq_pos(__cfqq->next_rq) < sector)
@@ -1700,7 +1701,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1700 return NULL; 1701 return NULL;
1701 1702
1702 __cfqq = rb_entry(node, struct cfq_queue, p_node); 1703 __cfqq = rb_entry(node, struct cfq_queue, p_node);
1703 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) 1704 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq))
1704 return __cfqq; 1705 return __cfqq;
1705 1706
1706 return NULL; 1707 return NULL;
@@ -3103,7 +3104,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 3104 * if this request is as-good as one we would expect from the
3104 * current cfqq, let it preempt 3105 * current cfqq, let it preempt
3105 */ 3106 */
3106 if (cfq_rq_close(cfqd, cfqq, rq, true)) 3107 if (cfq_rq_close(cfqd, cfqq, rq))
3107 return true; 3108 return true;
3108 3109
3109 return false; 3110 return false;