summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>2018-12-11 21:08:26 +0900
committerJens Axboe <axboe@kernel.dk>2018-12-11 16:19:38 -0700
commit927b6b2d69b4cc900fa50d7e46d8f1fa91c91b3a (patch)
treee1f46fa013f3a75142525c4a5a4c60b5f14d438c
parenta538e3ff9dabcdf6c3f477a373c629213d1c3066 (diff)
downloadlinux-927b6b2d69b4cc900fa50d7e46d8f1fa91c91b3a.tar.gz
linux-927b6b2d69b4cc900fa50d7e46d8f1fa91c91b3a.tar.bz2
linux-927b6b2d69b4cc900fa50d7e46d8f1fa91c91b3a.zip
block: Fix null_blk_zoned creation failure with small number of zones
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>
-rw-r--r--block/blk-zoned.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 13ba2011a306..a327bef07642 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -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,