[PATCH 5/6] block/bdev: lift restrictions on supported blocksize
Hannes Reinecke
hare at kernel.org
Tue May 14 10:38:59 PDT 2024
We now can support blocksizes larger than PAGE_SIZE, so lift
the restriction.
Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
block/bdev.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/block/bdev.c b/block/bdev.c
index bd2efcad4f32..f092a1b04629 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -148,8 +148,9 @@ static void set_init_blocksize(struct block_device *bdev)
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 MAX_PAGECACHE_ORDER*/
+ if (get_order(bs) > MAX_PAGECACHE_ORDER || size < 512 ||
+ !is_power_of_2(size))
return -EINVAL;
/* Size cannot be smaller than the size supported by the device */
@@ -174,7 +175,7 @@ int sb_set_blocksize(struct super_block *sb, int size)
if (set_blocksize(sb->s_bdev, size))
return 0;
/* If we get here, we know size is power of two
- * and it's value is between 512 and PAGE_SIZE */
+ * and it's value is larger than 512 */
sb->s_blocksize = size;
sb->s_blocksize_bits = blksize_bits(size);
return sb->s_blocksize;
--
2.35.3
More information about the Linux-nvme
mailing list