summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2015-11-24 02:35:31 (GMT)
committerJens Axboe <axboe@fb.com>2015-11-24 03:16:55 (GMT)
commit12e57f59ca3344a588531f68eeede45666e8a6e0 (patch)
treeab7fae19d98f36118ba64fd12eef25a23c47c65f
parent02e707424c2eadbcda68cd38876c9f4434ca8e1a (diff)
downloadlinux-12e57f59ca3344a588531f68eeede45666e8a6e0.tar.xz
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: Ming Lei <ming.lei@canonical.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/blk-merge.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 50793cd..41a55ba 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -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);