@@ -181,6 +181,8 @@ bool blk_integrity_merge_rq(struct request_queue *q, struct request *req,
if (integrity_req_gap_back_merge(req, next->bio))
return false;
+ req->nr_integrity_segments += next->nr_integrity_segments;
+
return true;
}
@@ -711,10 +711,11 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
if (!blk_cgroup_mergeable(req, next->bio))
return 0;
- if (blk_integrity_merge_rq(q, req, next) == false)
+ if (!bio_crypt_ctx_merge_rq(req, next))
return 0;
- if (!bio_crypt_ctx_merge_rq(req, next))
+ /* this will merge integrity segments */
+ if (!blk_integrity_merge_rq(q, req, next))
return 0;
/* Merge is OK... */
blk_integrity_merge_rq() merges integrity segment information of two requests. However, it is only a condition check and does not perform the actual integrity information update. So this was modified. After it is called, the merge process of the requests may fail due to other conditions. At this time, there is an error in the integrity segment information of request. So the call location was also changed. Cc: Christoph Hellwig <hch@lst.de> Cc: Martin K. Petersen <martin.petersen@oracle.com> Fixes: 13f05c8d8e98 ("block/scsi: Provide a limit on the number of integrity segments") Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com> --- block/blk-integrity.c | 2 ++ block/blk-merge.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)