aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-merge.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2012-09-18 12:19:25 -0400
committerJens Axboe <axboe@kernel.dk>2012-09-20 08:31:38 -0400
commite2a60da74fc8215c68509a89e9a69c66363153db (patch)
treec23dd6540dc211e2b2583c3e950a7f6977e3f1df /block/blk-merge.c
parentd41570b7469724005eb78448a69289900f911963 (diff)
block: Clean up special command handling logic
Remove special-casing of non-rw fs style requests (discard). The nomerge flags are consolidated in blk_types.h, and rq_mergeable() and bio_mergeable() have been modified to use them. bio_is_rw() is used in place of bio_has_data() a few places. This is done to to distinguish true reads and writes from other fs type requests that carry a payload (e.g. write same). Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-merge.c')
-rw-r--r--block/blk-merge.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index e76279e41162..86710ca408b8 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -418,18 +418,6 @@ static int attempt_merge(struct request_queue *q, struct request *req,
418 return 0; 418 return 0;
419 419
420 /* 420 /*
421 * Don't merge file system requests and discard requests
422 */
423 if ((req->cmd_flags & REQ_DISCARD) != (next->cmd_flags & REQ_DISCARD))
424 return 0;
425
426 /*
427 * Don't merge discard requests and secure discard requests
428 */
429 if ((req->cmd_flags & REQ_SECURE) != (next->cmd_flags & REQ_SECURE))
430 return 0;
431
432 /*
433 * not contiguous 421 * not contiguous
434 */ 422 */
435 if (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next)) 423 if (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next))
@@ -521,15 +509,7 @@ int blk_attempt_req_merge(struct request_queue *q, struct request *rq,
521 509
522bool blk_rq_merge_ok(struct request *rq, struct bio *bio) 510bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
523{ 511{
524 if (!rq_mergeable(rq)) 512 if (!rq_mergeable(rq) || !bio_mergeable(bio))
525 return false;
526
527 /* don't merge file system requests and discard requests */
528 if ((bio->bi_rw & REQ_DISCARD) != (rq->bio->bi_rw & REQ_DISCARD))
529 return false;
530
531 /* don't merge discard requests and secure discard requests */
532 if ((bio->bi_rw & REQ_SECURE) != (rq->bio->bi_rw & REQ_SECURE))
533 return false; 513 return false;
534 514
535 /* different data direction or already started, don't merge */ 515 /* different data direction or already started, don't merge */