Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12e57f59 authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe
Browse files

blk-merge: warn if figured out segment number is bigger than nr_phys_segments



We had seen lots of reports of this kind issue, so add one
warnning in blk-merge, then it can be triggered easily and
avoid to depend on warning/bug from drivers.

Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 02e70742
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -428,6 +428,12 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
	if (sg)
		sg_mark_end(sg);

	/*
	 * Something must have been wrong if the figured number of
	 * segment is bigger than number of req's physical segments
	 */
	WARN_ON(nsegs > rq->nr_phys_segments);

	return nsegs;
}
EXPORT_SYMBOL(blk_rq_map_sg);