blk-merge.c (d57c1cf43e7b33fdd790d50d972e0e5d6a0d20fe) | blk-merge.c (5b2050718d095cd3242d1f42aaaea3a2fec8e6f0) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Functions related to segment and merge handling 4 */ 5#include <linux/kernel.h> 6#include <linux/module.h> 7#include <linux/bio.h> 8#include <linux/blkdev.h> --- 768 unchanged lines hidden (view full) --- 777 778 if (rq_data_dir(req) != rq_data_dir(next)) 779 return NULL; 780 781 if (req_op(req) == REQ_OP_WRITE_SAME && 782 !blk_write_same_mergeable(req->bio, next->bio)) 783 return NULL; 784 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Functions related to segment and merge handling 4 */ 5#include <linux/kernel.h> 6#include <linux/module.h> 7#include <linux/bio.h> 8#include <linux/blkdev.h> --- 768 unchanged lines hidden (view full) --- 777 778 if (rq_data_dir(req) != rq_data_dir(next)) 779 return NULL; 780 781 if (req_op(req) == REQ_OP_WRITE_SAME && 782 !blk_write_same_mergeable(req->bio, next->bio)) 783 return NULL; 784 |
785 /* 786 * Don't allow merge of different write hints, or for a hint with 787 * non-hint IO. 788 */ 789 if (req->write_hint != next->write_hint) 790 return NULL; 791 |
|
785 if (req->ioprio != next->ioprio) 786 return NULL; 787 788 /* 789 * If we are allowed to merge, then append bio list 790 * from next to rq and release next. merge_requests_fn 791 * will have updated segment counts, update sector 792 * counts here. Handle DISCARDs separately, as they --- 110 unchanged lines hidden (view full) --- 903 if (!bio_crypt_rq_ctx_compatible(rq, bio)) 904 return false; 905 906 /* must be using the same buffer */ 907 if (req_op(rq) == REQ_OP_WRITE_SAME && 908 !blk_write_same_mergeable(rq->bio, bio)) 909 return false; 910 | 792 if (req->ioprio != next->ioprio) 793 return NULL; 794 795 /* 796 * If we are allowed to merge, then append bio list 797 * from next to rq and release next. merge_requests_fn 798 * will have updated segment counts, update sector 799 * counts here. Handle DISCARDs separately, as they --- 110 unchanged lines hidden (view full) --- 910 if (!bio_crypt_rq_ctx_compatible(rq, bio)) 911 return false; 912 913 /* must be using the same buffer */ 914 if (req_op(rq) == REQ_OP_WRITE_SAME && 915 !blk_write_same_mergeable(rq->bio, bio)) 916 return false; 917 |
918 /* 919 * Don't allow merge of different write hints, or for a hint with 920 * non-hint IO. 921 */ 922 if (rq->write_hint != bio->bi_write_hint) 923 return false; 924 |
|
911 if (rq->ioprio != bio_prio(bio)) 912 return false; 913 914 return true; 915} 916 917enum elv_merge blk_try_merge(struct request *rq, struct bio *bio) 918{ --- 149 unchanged lines hidden (view full) --- 1068{ 1069 struct blk_plug *plug; 1070 struct request *rq; 1071 1072 plug = blk_mq_plug(q, bio); 1073 if (!plug || rq_list_empty(plug->mq_list)) 1074 return false; 1075 | 925 if (rq->ioprio != bio_prio(bio)) 926 return false; 927 928 return true; 929} 930 931enum elv_merge blk_try_merge(struct request *rq, struct bio *bio) 932{ --- 149 unchanged lines hidden (view full) --- 1082{ 1083 struct blk_plug *plug; 1084 struct request *rq; 1085 1086 plug = blk_mq_plug(q, bio); 1087 if (!plug || rq_list_empty(plug->mq_list)) 1088 return false; 1089 |
1076 /* check the previously added entry for a quick merge attempt */ 1077 rq = rq_list_peek(&plug->mq_list); 1078 if (rq->q == q) { 1079 if (blk_attempt_bio_merge(q, rq, bio, nr_segs, false) == 1080 BIO_MERGE_OK) 1081 return true; | 1090 rq_list_for_each(&plug->mq_list, rq) { 1091 if (rq->q == q) { 1092 if (blk_attempt_bio_merge(q, rq, bio, nr_segs, false) == 1093 BIO_MERGE_OK) 1094 return true; 1095 break; 1096 } 1097 1098 /* 1099 * Only keep iterating plug list for merges if we have multiple 1100 * queues 1101 */ 1102 if (!plug->multiple_queues) 1103 break; |
1082 } 1083 return false; 1084} 1085 1086/* 1087 * Iterate list of requests and see if we can merge this bio with any 1088 * of them. 1089 */ --- 56 unchanged lines hidden --- | 1104 } 1105 return false; 1106} 1107 1108/* 1109 * Iterate list of requests and see if we can merge this bio with any 1110 * of them. 1111 */ --- 56 unchanged lines hidden --- |