Skip to content

Commit 26fff8a

Browse files
mcgrofaxboe
authored andcommitted
block/bdev: use helper for max block size check
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 <john.g.garry@oracle.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20241218020212.3657139-2-mcgrof@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent be26ba9 commit 26fff8a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

block/bdev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ int set_blocksize(struct file *file, int size)
155155
struct inode *inode = file->f_mapping->host;
156156
struct block_device *bdev = I_BDEV(inode);
157157

158-
/* Size must be a power of two, and between 512 and PAGE_SIZE */
159-
if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size))
158+
if (blk_validate_block_size(size))
160159
return -EINVAL;
161160

162161
/* Size cannot be smaller than the size supported by the device */

0 commit comments

Comments
 (0)