]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
block: Fix null_blk_zoned creation failure with small number of zones
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 11 Dec 2018 12:08:26 +0000 (21:08 +0900)
committerJens Axboe <axboe@kernel.dk>
Tue, 11 Dec 2018 23:19:38 +0000 (16:19 -0700)
null_blk_zoned creation fails if the number of zones specified is equal to or is
smaller than 64 due to a memory allocation failure in blk_alloc_zones(). With
such a small number of zones, the required memory size for all zones descriptors
fits in a single page, and the page order for alloc_pages_node() is zero. Allow
this value in blk_alloc_zones() for the allocation to succeed.

Fixes: bf5054569653 "block: Introduce blk_revalidate_disk_zones()"
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-zoned.c

index 13ba2011a306a8c4c52fe07bc7a5b147e86472a6..a327bef076422e52501be27ad4c7c4dee42dbb64 100644 (file)
@@ -378,7 +378,7 @@ static struct blk_zone *blk_alloc_zones(int node, unsigned int *nr_zones)
        struct page *page;
        int order;
 
-       for (order = get_order(size); order > 0; order--) {
+       for (order = get_order(size); order >= 0; order--) {
                page = alloc_pages_node(node, GFP_NOIO | __GFP_ZERO, order);
                if (page) {
                        *nr_zones = min_t(unsigned int, *nr_zones,