diff options
author | Christoph Hellwig <hch@lst.de> | 2017-02-08 08:46:48 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-02-08 15:43:06 -0500 |
commit | 34fe7c05400663e01e23cddd1fea68bb7a2b3d29 (patch) | |
tree | c03679f3bf7602925ecd9cbd6849af412b06d959 /block/blk-mq.c | |
parent | 6cf7677f1a94546e472658290b3b8bdbb16cc045 (diff) |
block: enumify ELEVATOR_*_MERGE
Switch these constants to an enum, and make let the compiler ensure that
all callers of blk_try_merge and elv_merge handle all potential values.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index e9957df05700..dd9722df4afe 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -763,7 +763,7 @@ static bool blk_mq_attempt_merge(struct request_queue *q, | |||
763 | int checked = 8; | 763 | int checked = 8; |
764 | 764 | ||
765 | list_for_each_entry_reverse(rq, &ctx->rq_list, queuelist) { | 765 | list_for_each_entry_reverse(rq, &ctx->rq_list, queuelist) { |
766 | int el_ret; | 766 | bool merged = false; |
767 | 767 | ||
768 | if (!checked--) | 768 | if (!checked--) |
769 | break; | 769 | break; |
@@ -771,26 +771,22 @@ static bool blk_mq_attempt_merge(struct request_queue *q, | |||
771 | if (!blk_rq_merge_ok(rq, bio)) | 771 | if (!blk_rq_merge_ok(rq, bio)) |
772 | continue; | 772 | continue; |
773 | 773 | ||
774 | el_ret = blk_try_merge(rq, bio); | 774 | switch (blk_try_merge(rq, bio)) { |
775 | if (el_ret == ELEVATOR_NO_MERGE) | 775 | case ELEVATOR_BACK_MERGE: |
776 | continue; | 776 | if (blk_mq_sched_allow_merge(q, rq, bio)) |
777 | 777 | merged = bio_attempt_back_merge(q, rq, bio); | |
778 | if (!blk_mq_sched_allow_merge(q, rq, bio)) | ||
779 | break; | 778 | break; |
780 | 779 | case ELEVATOR_FRONT_MERGE: | |
781 | if (el_ret == ELEVATOR_BACK_MERGE) { | 780 | if (blk_mq_sched_allow_merge(q, rq, bio)) |
782 | if (bio_attempt_back_merge(q, rq, bio)) { | 781 | merged = bio_attempt_front_merge(q, rq, bio); |
783 | ctx->rq_merged++; | ||
784 | return true; | ||
785 | } | ||
786 | break; | ||
787 | } else if (el_ret == ELEVATOR_FRONT_MERGE) { | ||
788 | if (bio_attempt_front_merge(q, rq, bio)) { | ||
789 | ctx->rq_merged++; | ||
790 | return true; | ||
791 | } | ||
792 | break; | 782 | break; |
783 | default: | ||
784 | continue; | ||
793 | } | 785 | } |
786 | |||
787 | if (merged) | ||
788 | ctx->rq_merged++; | ||
789 | return merged; | ||
794 | } | 790 | } |
795 | 791 | ||
796 | return false; | 792 | return false; |