sbitmap: warn if using smaller shallow depth than was setup
authorOmar Sandoval <osandov@fb.com>
Thu, 10 May 2018 00:29:24 +0000 (17:29 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 10 May 2018 17:27:52 +0000 (11:27 -0600)
Make sure the user passed the right value to
sbitmap_queue_min_shallow_depth().

Acked-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/sbitmap.c

index d21473b42465c4a87934564706035d1603f3e88f..8f0950fbaa5c60c402cd1565cfed4cdf71847390 100644 (file)
@@ -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)) {