From: Omar Sandoval Date: Thu, 10 May 2018 00:29:24 +0000 (-0700) Subject: sbitmap: warn if using smaller shallow depth than was setup X-Git-Tag: v4.18-rc1~192^2~124 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=61445b56d031bc12feafb477848cf4ef9a725fc9;p=nvme.git sbitmap: warn if using smaller shallow depth than was setup Make sure the user passed the right value to sbitmap_queue_min_shallow_depth(). Acked-by: Paolo Valente Signed-off-by: Omar Sandoval Signed-off-by: Jens Axboe --- diff --git a/lib/sbitmap.c b/lib/sbitmap.c index d21473b42465..8f0950fbaa5c 100644 --- a/lib/sbitmap.c +++ b/lib/sbitmap.c @@ -402,6 +402,8 @@ int __sbitmap_queue_get_shallow(struct sbitmap_queue *sbq, unsigned int hint, depth; int nr; + WARN_ON_ONCE(shallow_depth < sbq->min_shallow_depth); + hint = this_cpu_read(*sbq->alloc_hint); depth = READ_ONCE(sbq->sb.depth); if (unlikely(hint >= depth)) {