diff options
Diffstat (limited to 'block/blk-merge.c')
-rw-r--r-- | block/blk-merge.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c index 3b0cd4249671..6a725461654d 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -205,12 +205,11 @@ static inline int ll_new_hw_segment(struct request_queue *q, | |||
205 | { | 205 | { |
206 | int nr_phys_segs = bio_phys_segments(q, bio); | 206 | int nr_phys_segs = bio_phys_segments(q, bio); |
207 | 207 | ||
208 | if (req->nr_phys_segments + nr_phys_segs > queue_max_segments(q)) { | 208 | if (req->nr_phys_segments + nr_phys_segs > queue_max_segments(q)) |
209 | req->cmd_flags |= REQ_NOMERGE; | 209 | goto no_merge; |
210 | if (req == q->last_merge) | 210 | |
211 | q->last_merge = NULL; | 211 | if (bio_integrity(bio) && blk_integrity_merge_bio(q, req, bio)) |
212 | return 0; | 212 | goto no_merge; |
213 | } | ||
214 | 213 | ||
215 | /* | 214 | /* |
216 | * This will form the start of a new hw segment. Bump both | 215 | * This will form the start of a new hw segment. Bump both |
@@ -218,6 +217,12 @@ static inline int ll_new_hw_segment(struct request_queue *q, | |||
218 | */ | 217 | */ |
219 | req->nr_phys_segments += nr_phys_segs; | 218 | req->nr_phys_segments += nr_phys_segs; |
220 | return 1; | 219 | return 1; |
220 | |||
221 | no_merge: | ||
222 | req->cmd_flags |= REQ_NOMERGE; | ||
223 | if (req == q->last_merge) | ||
224 | q->last_merge = NULL; | ||
225 | return 0; | ||
221 | } | 226 | } |
222 | 227 | ||
223 | int ll_back_merge_fn(struct request_queue *q, struct request *req, | 228 | int ll_back_merge_fn(struct request_queue *q, struct request *req, |
@@ -301,6 +306,9 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, | |||
301 | if (total_phys_segments > queue_max_segments(q)) | 306 | if (total_phys_segments > queue_max_segments(q)) |
302 | return 0; | 307 | return 0; |
303 | 308 | ||
309 | if (blk_integrity_rq(req) && blk_integrity_merge_rq(q, req, next)) | ||
310 | return 0; | ||
311 | |||
304 | /* Merge is OK... */ | 312 | /* Merge is OK... */ |
305 | req->nr_phys_segments = total_phys_segments; | 313 | req->nr_phys_segments = total_phys_segments; |
306 | return 1; | 314 | return 1; |
@@ -372,9 +380,6 @@ static int attempt_merge(struct request_queue *q, struct request *req, | |||
372 | || next->special) | 380 | || next->special) |
373 | return 0; | 381 | return 0; |
374 | 382 | ||
375 | if (blk_integrity_rq(req) != blk_integrity_rq(next)) | ||
376 | return 0; | ||
377 | |||
378 | /* | 383 | /* |
379 | * If we are allowed to merge, then append bio list | 384 | * If we are allowed to merge, then append bio list |
380 | * from next to rq and release next. merge_requests_fn | 385 | * from next to rq and release next. merge_requests_fn |