The lowest value that can be supported for lim->max_user_sectors is the logical block size. This patch prepares for reducing BLK_MIN_SEGMENT_SIZE to a value that may be less than the logical block size. Cc: Ming Lei Fixes: 889c57066cee ("block: make segment size limit workable for > 4K PAGE_SIZE") Signed-off-by: Bart Van Assche --- block/blk-settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index 87724d30be4f..13f5457f9f4e 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -403,7 +403,7 @@ int blk_validate_limits(struct queue_limits *lim) max_hw_sectors = min_not_zero(lim->max_hw_sectors, lim->max_dev_sectors); if (lim->max_user_sectors) { - if (lim->max_user_sectors < BLK_MIN_SEGMENT_SIZE / SECTOR_SIZE) + if (lim->max_user_sectors < lim->logical_block_size / SECTOR_SIZE) return -EINVAL; lim->max_sectors = min(max_hw_sectors, lim->max_user_sectors); } else if (lim->io_opt > (BLK_DEF_MAX_SECTORS_CAP << SECTOR_SHIFT)) {