]> Git Repo - J-linux.git/commitdiff
block/bdev: use helper for max block size check
authorLuis Chamberlain <[email protected]>
Wed, 18 Dec 2024 02:02:11 +0000 (18:02 -0800)
committerJens Axboe <[email protected]>
Wed, 18 Dec 2024 14:22:30 +0000 (07:22 -0700)
We already have a helper for checking the limits on the block size
both low and high, just use that.

No functional changes.

Reviewed-by: John Garry <[email protected]>
Signed-off-by: Luis Chamberlain <[email protected]>
Reviewed-by: Keith Busch <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
block/bdev.c

index 738e3c8457e7f430332e6852e2b1baa2883af326..9d73a8fbf7f99712e4aead293e92734d25477abf 100644 (file)
@@ -155,8 +155,7 @@ int set_blocksize(struct file *file, int size)
        struct inode *inode = file->f_mapping->host;
        struct block_device *bdev = I_BDEV(inode);
 
-       /* Size must be a power of two, and between 512 and PAGE_SIZE */
-       if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size))
+       if (blk_validate_block_size(size))
                return -EINVAL;
 
        /* Size cannot be smaller than the size supported by the device */
This page took 0.05542 seconds and 4 git commands to generate.