summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2015-11-24 10:35:31 +0800
committerJens Axboe <axboe@fb.com>2015-11-23 20:16:55 -0700
commit12e57f59ca3344a588531f68eeede45666e8a6e0 (patch)
treeab7fae19d98f36118ba64fd12eef25a23c47c65f /block
parent02e707424c2eadbcda68cd38876c9f4434ca8e1a (diff)
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>
Diffstat (limited to 'block')
-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 50793cdc5331..41a55ba0d78e 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);