blk-merge.c (2fff8a924d4c614b5a17b2a236a2cf09aa51af5f) | blk-merge.c (cb6934f8ea1a595902ca37e250e0917d4dd7b2a7) |
---|---|
1/* 2 * Functions related to segment and merge handling 3 */ 4#include <linux/kernel.h> 5#include <linux/module.h> 6#include <linux/bio.h> 7#include <linux/blkdev.h> 8#include <linux/scatterlist.h> --- 659 unchanged lines hidden (view full) --- 668 || req_no_special_merge(next)) 669 return NULL; 670 671 if (req_op(req) == REQ_OP_WRITE_SAME && 672 !blk_write_same_mergeable(req->bio, next->bio)) 673 return NULL; 674 675 /* | 1/* 2 * Functions related to segment and merge handling 3 */ 4#include <linux/kernel.h> 5#include <linux/module.h> 6#include <linux/bio.h> 7#include <linux/blkdev.h> 8#include <linux/scatterlist.h> --- 659 unchanged lines hidden (view full) --- 668 || req_no_special_merge(next)) 669 return NULL; 670 671 if (req_op(req) == REQ_OP_WRITE_SAME && 672 !blk_write_same_mergeable(req->bio, next->bio)) 673 return NULL; 674 675 /* |
676 * Don't allow merge of different write hints, or for a hint with 677 * non-hint IO. 678 */ 679 if (req->write_hint != next->write_hint) 680 return NULL; 681 682 /* |
|
676 * If we are allowed to merge, then append bio list 677 * from next to rq and release next. merge_requests_fn 678 * will have updated segment counts, update sector 679 * counts here. 680 */ 681 if (!ll_merge_requests_fn(q, req, next)) 682 return NULL; 683 --- 102 unchanged lines hidden (view full) --- 786 if (blk_integrity_merge_bio(rq->q, rq, bio) == false) 787 return false; 788 789 /* must be using the same buffer */ 790 if (req_op(rq) == REQ_OP_WRITE_SAME && 791 !blk_write_same_mergeable(rq->bio, bio)) 792 return false; 793 | 683 * If we are allowed to merge, then append bio list 684 * from next to rq and release next. merge_requests_fn 685 * will have updated segment counts, update sector 686 * counts here. 687 */ 688 if (!ll_merge_requests_fn(q, req, next)) 689 return NULL; 690 --- 102 unchanged lines hidden (view full) --- 793 if (blk_integrity_merge_bio(rq->q, rq, bio) == false) 794 return false; 795 796 /* must be using the same buffer */ 797 if (req_op(rq) == REQ_OP_WRITE_SAME && 798 !blk_write_same_mergeable(rq->bio, bio)) 799 return false; 800 |
801 /* 802 * Don't allow merge of different write hints, or for a hint with 803 * non-hint IO. 804 */ 805 if (rq->write_hint != bio->bi_write_hint) 806 return false; 807 |
|
794 return true; 795} 796 797enum elv_merge blk_try_merge(struct request *rq, struct bio *bio) 798{ 799 if (req_op(rq) == REQ_OP_DISCARD && 800 queue_max_discard_segments(rq->q) > 1) 801 return ELEVATOR_DISCARD_MERGE; 802 else if (blk_rq_pos(rq) + blk_rq_sectors(rq) == bio->bi_iter.bi_sector) 803 return ELEVATOR_BACK_MERGE; 804 else if (blk_rq_pos(rq) - bio_sectors(bio) == bio->bi_iter.bi_sector) 805 return ELEVATOR_FRONT_MERGE; 806 return ELEVATOR_NO_MERGE; 807} | 808 return true; 809} 810 811enum elv_merge blk_try_merge(struct request *rq, struct bio *bio) 812{ 813 if (req_op(rq) == REQ_OP_DISCARD && 814 queue_max_discard_segments(rq->q) > 1) 815 return ELEVATOR_DISCARD_MERGE; 816 else if (blk_rq_pos(rq) + blk_rq_sectors(rq) == bio->bi_iter.bi_sector) 817 return ELEVATOR_BACK_MERGE; 818 else if (blk_rq_pos(rq) - bio_sectors(bio) == bio->bi_iter.bi_sector) 819 return ELEVATOR_FRONT_MERGE; 820 return ELEVATOR_NO_MERGE; 821} |