blob: 66279fb737d93af9d19c99efddd2b4c1d9c8dac4 [file] [log] [blame]
From 76598d66ce3b0ffe431a312346706b1d8138286a Mon Sep 17 00:00:00 2001
From: Konstantin Khlebnikov <>
Date: Fri, 28 Feb 2020 17:51:48 +0300
Subject: [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for
stacked devices
commit e74d93e96d721c4297f2a900ad0191890d2fc2b0 upstream.
Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request
size based on read-ahead setting") removes unneeded split of read requests.
Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they set
limits of their devices by blk_set_stacking_limits() + disk_stack_limits().
Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.
This patch updates io_pages after merging limits in disk_stack_limits().
Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed
the same problem for device-mapper devices, this one fixes MD RAIDs.
Fixes: 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting")
Reviewed-by: Paul Menzel <>
Reviewed-by: Bob Liu <>
Signed-off-by: Konstantin Khlebnikov <>
Signed-off-by: Song Liu <>
Signed-off-by: Paul Gortmaker <>
diff --git a/block/blk-settings.c b/block/blk-settings.c
index db7d01fd921b..2790f5365523 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -663,6 +663,9 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
top, bottom);
+ t->backing_dev_info->io_pages =
+ t->limits.max_sectors >> (PAGE_SHIFT - 9);