Unverified Commit 77eb6443 authored by Pankaj Raghav's avatar Pankaj Raghav Committed by Christian Brauner
Browse files

fs/buffer: remove the min and max limit checks in __getblk_slow()



All filesystems will already check the max and min value of their block
size during their initialization. __getblk_slow() is a very low-level
function to have these checks. Remove them and only check for logical
block size alignment.

As this check with logical block size alignment might never trigger, add
WARN_ON_ONCE() to the check. As WARN_ON_ONCE() will already print the
stack, remove the call to dump_stack().

Suggested-by: default avatarMatthew Wilcox <willy@infradead.org>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarPankaj Raghav <p.raghav@samsung.com>
Link: https://lore.kernel.org/20250626113223.181399-1-p.raghav@samsung.com


Reviewed-by: default avatarBaokun Li <libaokun1@huawei.com>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 04a2c4b4
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -1122,14 +1122,9 @@ __getblk_slow(struct block_device *bdev, sector_t block,
{
	bool blocking = gfpflags_allow_blocking(gfp);

	if (unlikely(size & (bdev_logical_block_size(bdev) - 1) ||
		     (size < 512 || size > PAGE_SIZE))) {
		printk(KERN_ERR "getblk(): invalid block size %d requested\n",
					size);
		printk(KERN_ERR "logical block size: %d\n",
					bdev_logical_block_size(bdev));

		dump_stack();
	if (WARN_ON_ONCE(!IS_ALIGNED(size, bdev_logical_block_size(bdev)))) {
		printk(KERN_ERR "getblk(): block size %d not aligned to logical block size %d\n",
		       size, bdev_logical_block_size(bdev));
		return NULL;
	}