Commit 569fd0ce96087283866ab8c438dac4bcf1738846
1 parent
54e514b91b
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
blk-mq: fix iteration of busy bitmap
Commit 889fa31f00b2 was a bit too eager in reducing the loop count, so we ended up missing queues in some configurations. Ensure that our division rounds up, so that's not the case. Reported-by: Guenter Roeck <linux@roeck-us.net> Fixes: 889fa31f00b2 ("blk-mq: reduce unnecessary software queue looping") Signed-off-by: Jens Axboe <axboe@fb.com>
Showing 2 changed files with 4 additions and 4 deletions Side-by-side Diff
block/blk-mq.c
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | { |
42 | 42 | unsigned int i; |
43 | 43 | |
44 | - for (i = 0; i < hctx->ctx_map.map_size; i++) | |
44 | + for (i = 0; i < hctx->ctx_map.size; i++) | |
45 | 45 | if (hctx->ctx_map.map[i].word) |
46 | 46 | return true; |
47 | 47 | |
... | ... | @@ -730,7 +730,7 @@ |
730 | 730 | struct blk_mq_ctx *ctx; |
731 | 731 | int i; |
732 | 732 | |
733 | - for (i = 0; i < hctx->ctx_map.map_size; i++) { | |
733 | + for (i = 0; i < hctx->ctx_map.size; i++) { | |
734 | 734 | struct blk_align_bitmap *bm = &hctx->ctx_map.map[i]; |
735 | 735 | unsigned int off, bit; |
736 | 736 | |
... | ... | @@ -1818,7 +1818,7 @@ |
1818 | 1818 | * This is more accurate and more efficient than looping |
1819 | 1819 | * over all possibly mapped software queues. |
1820 | 1820 | */ |
1821 | - map->map_size = hctx->nr_ctx / map->bits_per_word; | |
1821 | + map->size = DIV_ROUND_UP(hctx->nr_ctx, map->bits_per_word); | |
1822 | 1822 | |
1823 | 1823 | /* |
1824 | 1824 | * Initialize batch roundrobin counts |