[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <u7fadbfaq5wm7nqhn4yewbn43h3ahxuqm536ly473uch2v5qfl@hpgo2dfg77jp>
Date: Wed, 25 Jun 2025 12:16:49 +0200
From: Jan Kara <jack@...e.cz>
To: Pankaj Raghav <p.raghav@...sung.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>,
mcgrof@...nel.org, Christian Brauner <brauner@...nel.org>, kernel@...kajraghav.com,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, gost.dev@...sung.com,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v3] fs/buffer: remove the min and max limit checks in
__getblk_slow()
On Wed 25-06-25 10:37:04, Pankaj Raghav wrote:
> 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.
>
> Suggested-by: Matthew Wilcox <willy@...radead.org>
> Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
I know this is a bikeshedding but FWIW this is in the should never trigger
territory so I'd be inclined to just make it WARN_ON_ONCE() and completely
delete it once we refactor bh apis to make sure nobody can call bh
functions with anything else than sb->s_blocksize.
Honza
> ---
> Changes since v2:
> - Removed the max and min checks in __getblk_slow().
>
> fs/buffer.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/fs/buffer.c b/fs/buffer.c
> index a14d281c6a74..a1aa01ebc0ce 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -1122,13 +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));
> -
> + if (unlikely(size & (bdev_logical_block_size(bdev) - 1))) {
> + printk(KERN_ERR "getblk(): block size %d not aligned to logical block size %d\n",
> + size, bdev_logical_block_size(bdev));
> dump_stack();
> return NULL;
> }
>
> base-commit: 6ae58121126dcf8efcc2611f216a36a5e50b8ad9
> --
> 2.49.0
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists