block: consider discard merge last
PATCH 1/1 block: consider discard merge last
From: Keith Busch <[email protected]>
If the next discard range is contiguous with the current range being considered, it's cheaper to expand the current range than to append an additional bio.
Signed-off-by Keith Busch <[email protected]>
--- block/blk-merge.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
block/blk-merge.c +6 -6
@@ -712,10 +712,10 @@ static void blk_account_io_merge_request(struct request *req)static enum elv_merge blk_try_req_merge (struct request *req,struct request *next) { -if (blk_discard_mergable (req)) -return ELEVATOR_DISCARD_MERGE ; -else if (blk_rq_pos (req) +blk_rq_sectors (req) ==blk_rq_pos (next)) +if (blk_rq_pos (req) +blk_rq_sectors (req) ==blk_rq_pos (next))return ELEVATOR_BACK_MERGE ; +else if (blk_discard_mergable (req)) +return ELEVATOR_DISCARD_MERGE ;return ELEVATOR_NO_MERGE ; }
@@ -903,12 +903,12 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)enum elv_merge blk_try_merge (struct request *rq,struct bio *bio) { -if (blk_discard_mergable (rq)) -return ELEVATOR_DISCARD_MERGE ; -else if (blk_rq_pos (rq) +blk_rq_sectors (rq) == bio->bi_iter.bi_sector) +if (blk_rq_pos (rq) +blk_rq_sectors (rq) == bio->bi_iter.bi_sector)return ELEVATOR_BACK_MERGE ;else if (blk_rq_pos (rq) -bio_sectors (bio) == bio->bi_iter.bi_sector)return ELEVATOR_FRONT_MERGE ; +else if (blk_discard_mergable (rq)) +return ELEVATOR_DISCARD_MERGE ;return ELEVATOR_NO_MERGE ; }
Signature · 1 line
2.47.3
Quoted 7 lines · Keith Busch
From: Keith Busch<[email protected]>
If the next discard range is contiguous with the current range being considered, it's cheaper to expand the current range than to append an additional bio.
Signed-off-by Keith Busch<[email protected]>
Looks good.
Reviewed-by Chaitanya Kulkarni <[email protected]>
-ck
Quoted 5 lines · Keith Busch
If the next discard range is contiguous with the current range being considered, it's cheaper to expand the current range than to append an additional bio.
Applied, thanks!
[1/1] block: consider discard merge last
commit: 2516c246d01c23a5f5310e9ac78d9f8aad9b1d0e
Best regards,
Signature · 1 line
Jens Axboe