diff options
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/block/elevator.c b/block/elevator.c index 923a9139106c..816a7c8d6394 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -79,8 +79,7 @@ int elv_rq_merge_ok(struct request *rq, struct bio *bio) | |||
79 | /* | 79 | /* |
80 | * Don't merge file system requests and discard requests | 80 | * Don't merge file system requests and discard requests |
81 | */ | 81 | */ |
82 | if (bio_rw_flagged(bio, BIO_RW_DISCARD) != | 82 | if ((bio->bi_rw & REQ_DISCARD) != (rq->bio->bi_rw & REQ_DISCARD)) |
83 | bio_rw_flagged(rq->bio, BIO_RW_DISCARD)) | ||
84 | return 0; | 83 | return 0; |
85 | 84 | ||
86 | /* | 85 | /* |
@@ -428,7 +427,8 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq) | |||
428 | list_for_each_prev(entry, &q->queue_head) { | 427 | list_for_each_prev(entry, &q->queue_head) { |
429 | struct request *pos = list_entry_rq(entry); | 428 | struct request *pos = list_entry_rq(entry); |
430 | 429 | ||
431 | if (blk_discard_rq(rq) != blk_discard_rq(pos)) | 430 | if ((rq->cmd_flags & REQ_DISCARD) != |
431 | (pos->cmd_flags & REQ_DISCARD)) | ||
432 | break; | 432 | break; |
433 | if (rq_data_dir(rq) != rq_data_dir(pos)) | 433 | if (rq_data_dir(rq) != rq_data_dir(pos)) |
434 | break; | 434 | break; |
@@ -558,7 +558,7 @@ void elv_requeue_request(struct request_queue *q, struct request *rq) | |||
558 | */ | 558 | */ |
559 | if (blk_account_rq(rq)) { | 559 | if (blk_account_rq(rq)) { |
560 | q->in_flight[rq_is_sync(rq)]--; | 560 | q->in_flight[rq_is_sync(rq)]--; |
561 | if (blk_sorted_rq(rq)) | 561 | if (rq->cmd_flags & REQ_SORTED) |
562 | elv_deactivate_rq(q, rq); | 562 | elv_deactivate_rq(q, rq); |
563 | } | 563 | } |
564 | 564 | ||
@@ -644,7 +644,8 @@ void elv_insert(struct request_queue *q, struct request *rq, int where) | |||
644 | break; | 644 | break; |
645 | 645 | ||
646 | case ELEVATOR_INSERT_SORT: | 646 | case ELEVATOR_INSERT_SORT: |
647 | BUG_ON(!blk_fs_request(rq) && !blk_discard_rq(rq)); | 647 | BUG_ON(rq->cmd_type != REQ_TYPE_FS && |
648 | !(rq->cmd_flags & REQ_DISCARD)); | ||
648 | rq->cmd_flags |= REQ_SORTED; | 649 | rq->cmd_flags |= REQ_SORTED; |
649 | q->nr_sorted++; | 650 | q->nr_sorted++; |
650 | if (rq_mergeable(rq)) { | 651 | if (rq_mergeable(rq)) { |
@@ -716,7 +717,7 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where, | |||
716 | /* | 717 | /* |
717 | * toggle ordered color | 718 | * toggle ordered color |
718 | */ | 719 | */ |
719 | if (blk_barrier_rq(rq)) | 720 | if (rq->cmd_flags & REQ_HARDBARRIER) |
720 | q->ordcolor ^= 1; | 721 | q->ordcolor ^= 1; |
721 | 722 | ||
722 | /* | 723 | /* |
@@ -729,7 +730,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where, | |||
729 | * this request is scheduling boundary, update | 730 | * this request is scheduling boundary, update |
730 | * end_sector | 731 | * end_sector |
731 | */ | 732 | */ |
732 | if (blk_fs_request(rq) || blk_discard_rq(rq)) { | 733 | if (rq->cmd_type == REQ_TYPE_FS || |
734 | (rq->cmd_flags & REQ_DISCARD)) { | ||
733 | q->end_sector = rq_end_sector(rq); | 735 | q->end_sector = rq_end_sector(rq); |
734 | q->boundary_rq = rq; | 736 | q->boundary_rq = rq; |
735 | } | 737 | } |
@@ -843,7 +845,8 @@ void elv_completed_request(struct request_queue *q, struct request *rq) | |||
843 | */ | 845 | */ |
844 | if (blk_account_rq(rq)) { | 846 | if (blk_account_rq(rq)) { |
845 | q->in_flight[rq_is_sync(rq)]--; | 847 | q->in_flight[rq_is_sync(rq)]--; |
846 | if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn) | 848 | if ((rq->cmd_flags & REQ_SORTED) && |
849 | e->ops->elevator_completed_req_fn) | ||
847 | e->ops->elevator_completed_req_fn(q, rq); | 850 | e->ops->elevator_completed_req_fn(q, rq); |
848 | } | 851 | } |
849 | 852 | ||