aboutsummaryrefslogtreecommitdiffstats
path: root/block/elevator.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 923a9139106c..aa99b59c03d6 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -428,7 +428,8 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
428 list_for_each_prev(entry, &q->queue_head) { 428 list_for_each_prev(entry, &q->queue_head) {
429 struct request *pos = list_entry_rq(entry); 429 struct request *pos = list_entry_rq(entry);
430 430
431 if (blk_discard_rq(rq) != blk_discard_rq(pos)) 431 if ((rq->cmd_flags & REQ_DISCARD) !=
432 (pos->cmd_flags & REQ_DISCARD))
432 break; 433 break;
433 if (rq_data_dir(rq) != rq_data_dir(pos)) 434 if (rq_data_dir(rq) != rq_data_dir(pos))
434 break; 435 break;
@@ -558,7 +559,7 @@ void elv_requeue_request(struct request_queue *q, struct request *rq)
558 */ 559 */
559 if (blk_account_rq(rq)) { 560 if (blk_account_rq(rq)) {
560 q->in_flight[rq_is_sync(rq)]--; 561 q->in_flight[rq_is_sync(rq)]--;
561 if (blk_sorted_rq(rq)) 562 if (rq->cmd_flags & REQ_SORTED)
562 elv_deactivate_rq(q, rq); 563 elv_deactivate_rq(q, rq);
563 } 564 }
564 565
@@ -644,7 +645,8 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
644 break; 645 break;
645 646
646 case ELEVATOR_INSERT_SORT: 647 case ELEVATOR_INSERT_SORT:
647 BUG_ON(!blk_fs_request(rq) && !blk_discard_rq(rq)); 648 BUG_ON(rq->cmd_type != REQ_TYPE_FS &&
649 !(rq->cmd_flags & REQ_DISCARD));
648 rq->cmd_flags |= REQ_SORTED; 650 rq->cmd_flags |= REQ_SORTED;
649 q->nr_sorted++; 651 q->nr_sorted++;
650 if (rq_mergeable(rq)) { 652 if (rq_mergeable(rq)) {
@@ -716,7 +718,7 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
716 /* 718 /*
717 * toggle ordered color 719 * toggle ordered color
718 */ 720 */
719 if (blk_barrier_rq(rq)) 721 if (rq->cmd_flags & REQ_HARDBARRIER)
720 q->ordcolor ^= 1; 722 q->ordcolor ^= 1;
721 723
722 /* 724 /*
@@ -729,7 +731,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
729 * this request is scheduling boundary, update 731 * this request is scheduling boundary, update
730 * end_sector 732 * end_sector
731 */ 733 */
732 if (blk_fs_request(rq) || blk_discard_rq(rq)) { 734 if (rq->cmd_type == REQ_TYPE_FS ||
735 (rq->cmd_flags & REQ_DISCARD)) {
733 q->end_sector = rq_end_sector(rq); 736 q->end_sector = rq_end_sector(rq);
734 q->boundary_rq = rq; 737 q->boundary_rq = rq;
735 } 738 }
@@ -843,7 +846,8 @@ void elv_completed_request(struct request_queue *q, struct request *rq)
843 */ 846 */
844 if (blk_account_rq(rq)) { 847 if (blk_account_rq(rq)) {
845 q->in_flight[rq_is_sync(rq)]--; 848 q->in_flight[rq_is_sync(rq)]--;
846 if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn) 849 if ((rq->cmd_flags & REQ_SORTED) &&
850 e->ops->elevator_completed_req_fn)
847 e->ops->elevator_completed_req_fn(q, rq); 851 e->ops->elevator_completed_req_fn(q, rq);
848 } 852 }
849 853