aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c4
-rw-r--r--block/blk-flush.c6
-rw-r--r--block/blk-integrity.c12
-rw-r--r--block/blk-throttle.c4
-rw-r--r--block/elevator.c35
5 files changed, 33 insertions, 28 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 071ae6d2768..90f22cc3079 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2163,7 +2163,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
2163 * size, something has gone terribly wrong. 2163 * size, something has gone terribly wrong.
2164 */ 2164 */
2165 if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) { 2165 if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) {
2166 printk(KERN_ERR "blk: request botched\n"); 2166 blk_dump_rq_flags(req, "request botched");
2167 req->__data_len = blk_rq_cur_bytes(req); 2167 req->__data_len = blk_rq_cur_bytes(req);
2168 } 2168 }
2169 2169
@@ -2665,7 +2665,7 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b)
2665 struct request *rqa = container_of(a, struct request, queuelist); 2665 struct request *rqa = container_of(a, struct request, queuelist);
2666 struct request *rqb = container_of(b, struct request, queuelist); 2666 struct request *rqb = container_of(b, struct request, queuelist);
2667 2667
2668 return !(rqa->q == rqb->q); 2668 return !(rqa->q <= rqb->q);
2669} 2669}
2670 2670
2671static void flush_plug_list(struct blk_plug *plug) 2671static void flush_plug_list(struct blk_plug *plug)
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 93d5fd8e51e..eba4a2790c6 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -261,7 +261,7 @@ static bool blk_kick_flush(struct request_queue *q)
261 q->flush_rq.end_io = flush_end_io; 261 q->flush_rq.end_io = flush_end_io;
262 262
263 q->flush_pending_idx ^= 1; 263 q->flush_pending_idx ^= 1;
264 elv_insert(q, &q->flush_rq, ELEVATOR_INSERT_REQUEUE); 264 list_add_tail(&q->flush_rq.queuelist, &q->queue_head);
265 return true; 265 return true;
266} 266}
267 267
@@ -281,7 +281,7 @@ static void flush_data_end_io(struct request *rq, int error)
281 * blk_insert_flush - insert a new FLUSH/FUA request 281 * blk_insert_flush - insert a new FLUSH/FUA request
282 * @rq: request to insert 282 * @rq: request to insert
283 * 283 *
284 * To be called from elv_insert() for %ELEVATOR_INSERT_FLUSH insertions. 284 * To be called from __elv_add_request() for %ELEVATOR_INSERT_FLUSH insertions.
285 * @rq is being submitted. Analyze what needs to be done and put it on the 285 * @rq is being submitted. Analyze what needs to be done and put it on the
286 * right queue. 286 * right queue.
287 * 287 *
@@ -312,7 +312,7 @@ void blk_insert_flush(struct request *rq)
312 */ 312 */
313 if ((policy & REQ_FSEQ_DATA) && 313 if ((policy & REQ_FSEQ_DATA) &&
314 !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { 314 !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) {
315 list_add(&rq->queuelist, &q->queue_head); 315 list_add_tail(&rq->queuelist, &q->queue_head);
316 return; 316 return;
317 } 317 }
318 318
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 54bcba6c02a..129b9e209a3 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -30,6 +30,8 @@
30 30
31static struct kmem_cache *integrity_cachep; 31static struct kmem_cache *integrity_cachep;
32 32
33static const char *bi_unsupported_name = "unsupported";
34
33/** 35/**
34 * blk_rq_count_integrity_sg - Count number of integrity scatterlist elements 36 * blk_rq_count_integrity_sg - Count number of integrity scatterlist elements
35 * @q: request queue 37 * @q: request queue
@@ -358,6 +360,14 @@ static struct kobj_type integrity_ktype = {
358 .release = blk_integrity_release, 360 .release = blk_integrity_release,
359}; 361};
360 362
363bool blk_integrity_is_initialized(struct gendisk *disk)
364{
365 struct blk_integrity *bi = blk_get_integrity(disk);
366
367 return (bi && bi->name && strcmp(bi->name, bi_unsupported_name) != 0);
368}
369EXPORT_SYMBOL(blk_integrity_is_initialized);
370
361/** 371/**
362 * blk_integrity_register - Register a gendisk as being integrity-capable 372 * blk_integrity_register - Register a gendisk as being integrity-capable
363 * @disk: struct gendisk pointer to make integrity-aware 373 * @disk: struct gendisk pointer to make integrity-aware
@@ -407,7 +417,7 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
407 bi->get_tag_fn = template->get_tag_fn; 417 bi->get_tag_fn = template->get_tag_fn;
408 bi->tag_size = template->tag_size; 418 bi->tag_size = template->tag_size;
409 } else 419 } else
410 bi->name = "unsupported"; 420 bi->name = bi_unsupported_name;
411 421
412 return 0; 422 return 0;
413} 423}
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index c8b16c88b31..0475a22a420 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -77,7 +77,7 @@ struct throtl_grp {
77 unsigned long slice_end[2]; 77 unsigned long slice_end[2];
78 78
79 /* Some throttle limits got updated for the group */ 79 /* Some throttle limits got updated for the group */
80 bool limits_changed; 80 int limits_changed;
81}; 81};
82 82
83struct throtl_data 83struct throtl_data
@@ -102,7 +102,7 @@ struct throtl_data
102 /* Work for dispatching throttled bios */ 102 /* Work for dispatching throttled bios */
103 struct delayed_work throtl_work; 103 struct delayed_work throtl_work;
104 104
105 bool limits_changed; 105 int limits_changed;
106}; 106};
107 107
108enum tg_state_flags { 108enum tg_state_flags {
diff --git a/block/elevator.c b/block/elevator.c
index c387d316873..0cdb4e7ebab 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -610,7 +610,7 @@ void elv_requeue_request(struct request_queue *q, struct request *rq)
610 610
611 rq->cmd_flags &= ~REQ_STARTED; 611 rq->cmd_flags &= ~REQ_STARTED;
612 612
613 elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE); 613 __elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE);
614} 614}
615 615
616void elv_drain_elevator(struct request_queue *q) 616void elv_drain_elevator(struct request_queue *q)
@@ -655,12 +655,25 @@ void elv_quiesce_end(struct request_queue *q)
655 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q); 655 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
656} 656}
657 657
658void elv_insert(struct request_queue *q, struct request *rq, int where) 658void __elv_add_request(struct request_queue *q, struct request *rq, int where)
659{ 659{
660 trace_block_rq_insert(q, rq); 660 trace_block_rq_insert(q, rq);
661 661
662 rq->q = q; 662 rq->q = q;
663 663
664 BUG_ON(rq->cmd_flags & REQ_ON_PLUG);
665
666 if (rq->cmd_flags & REQ_SOFTBARRIER) {
667 /* barriers are scheduling boundary, update end_sector */
668 if (rq->cmd_type == REQ_TYPE_FS ||
669 (rq->cmd_flags & REQ_DISCARD)) {
670 q->end_sector = rq_end_sector(rq);
671 q->boundary_rq = rq;
672 }
673 } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
674 where == ELEVATOR_INSERT_SORT)
675 where = ELEVATOR_INSERT_BACK;
676
664 switch (where) { 677 switch (where) {
665 case ELEVATOR_INSERT_REQUEUE: 678 case ELEVATOR_INSERT_REQUEUE:
666 case ELEVATOR_INSERT_FRONT: 679 case ELEVATOR_INSERT_FRONT:
@@ -722,24 +735,6 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
722 BUG(); 735 BUG();
723 } 736 }
724} 737}
725
726void __elv_add_request(struct request_queue *q, struct request *rq, int where)
727{
728 BUG_ON(rq->cmd_flags & REQ_ON_PLUG);
729
730 if (rq->cmd_flags & REQ_SOFTBARRIER) {
731 /* barriers are scheduling boundary, update end_sector */
732 if (rq->cmd_type == REQ_TYPE_FS ||
733 (rq->cmd_flags & REQ_DISCARD)) {
734 q->end_sector = rq_end_sector(rq);
735 q->boundary_rq = rq;
736 }
737 } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
738 where == ELEVATOR_INSERT_SORT)
739 where = ELEVATOR_INSERT_BACK;
740
741 elv_insert(q, rq, where);
742}
743EXPORT_SYMBOL(__elv_add_request); 738EXPORT_SYMBOL(__elv_add_request);
744 739
745void elv_add_request(struct request_queue *q, struct request *rq, int where) 740void elv_add_request(struct request_queue *q, struct request *rq, int where)