While buffer-heads is stuck at order 0, so PAGE_SIZE, iomap support is currently capped at MAX_PAGECACHE_ORDER as that is the cap also set on readahead. We match parity for the max allowed block size when using iomap. Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx> --- block/bdev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/block/bdev.c b/block/bdev.c index 63b4d7dd8075..0d685270cd34 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -143,10 +143,17 @@ static void set_init_blocksize(struct block_device *bdev) } } +static int bdev_bsize_limit(struct block_device *bdev) +{ + if (bdev->bd_inode->i_data.a_ops == &def_blk_aops_iomap) + return 1 << (PAGE_SHIFT + MAX_PAGECACHE_ORDER); + return PAGE_SIZE; +} + int set_blocksize(struct block_device *bdev, int size) { - /* Size must be a power of two, and between 512 and PAGE_SIZE */ - if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size)) + /* Size must be a power of two, and between 512 and supported order */ + if (size > bdev_bsize_limit(bdev) || size < 512 || !is_power_of_2(size)) return -EINVAL; /* Size cannot be smaller than the size supported by the device */ -- 2.39.2