aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-sysfs.c11
-rw-r--r--block/elevator.c11
2 files changed, 17 insertions, 5 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 8606c9543fdd..e85442415db3 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -189,7 +189,8 @@ static ssize_t queue_nonrot_store(struct request_queue *q, const char *page,
189 189
190static ssize_t queue_nomerges_show(struct request_queue *q, char *page) 190static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
191{ 191{
192 return queue_var_show(blk_queue_nomerges(q), page); 192 return queue_var_show((blk_queue_nomerges(q) << 1) |
193 blk_queue_noxmerges(q), page);
193} 194}
194 195
195static ssize_t queue_nomerges_store(struct request_queue *q, const char *page, 196static ssize_t queue_nomerges_store(struct request_queue *q, const char *page,
@@ -199,10 +200,12 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page,
199 ssize_t ret = queue_var_store(&nm, page, count); 200 ssize_t ret = queue_var_store(&nm, page, count);
200 201
201 spin_lock_irq(q->queue_lock); 202 spin_lock_irq(q->queue_lock);
202 if (nm) 203 queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
204 queue_flag_clear(QUEUE_FLAG_NOXMERGES, q);
205 if (nm == 2)
203 queue_flag_set(QUEUE_FLAG_NOMERGES, q); 206 queue_flag_set(QUEUE_FLAG_NOMERGES, q);
204 else 207 else if (nm)
205 queue_flag_clear(QUEUE_FLAG_NOMERGES, q); 208 queue_flag_set(QUEUE_FLAG_NOXMERGES, q);
206 spin_unlock_irq(q->queue_lock); 209 spin_unlock_irq(q->queue_lock);
207 210
208 return ret; 211 return ret;
diff --git a/block/elevator.c b/block/elevator.c
index 9ad5ccc4c5ee..ee3a883840f2 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -474,6 +474,15 @@ int elv_merge(struct request_queue *q, struct request **req, struct bio *bio)
474 int ret; 474 int ret;
475 475
476 /* 476 /*
477 * Levels of merges:
478 * nomerges: No merges at all attempted
479 * noxmerges: Only simple one-hit cache try
480 * merges: All merge tries attempted
481 */
482 if (blk_queue_nomerges(q))
483 return ELEVATOR_NO_MERGE;
484
485 /*
477 * First try one-hit cache. 486 * First try one-hit cache.
478 */ 487 */
479 if (q->last_merge) { 488 if (q->last_merge) {
@@ -484,7 +493,7 @@ int elv_merge(struct request_queue *q, struct request **req, struct bio *bio)
484 } 493 }
485 } 494 }
486 495
487 if (blk_queue_nomerges(q)) 496 if (blk_queue_noxmerges(q))
488 return ELEVATOR_NO_MERGE; 497 return ELEVATOR_NO_MERGE;
489 498
490 /* 499 /*