From: Pankaj Raghav <p.raghav@samsung.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
mcgrof@kernel.org, Christian Brauner <brauner@kernel.org>
Cc: kernel@pankajraghav.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, gost.dev@samsung.com,
Pankaj Raghav <p.raghav@samsung.com>,
Matthew Wilcox <willy@infradead.org>
Subject: [PATCH v3] fs/buffer: remove the min and max limit checks in __getblk_slow()
Date: Wed, 25 Jun 2025 10:37:04 +0200 [thread overview]
Message-ID: <20250625083704.167993-1-p.raghav@samsung.com> (raw)
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@infradead.org>
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
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
next reply other threads:[~2025-06-25 8:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 8:37 Pankaj Raghav [this message]
2025-06-25 10:16 ` Jan Kara
2025-06-25 10:53 ` Pankaj Raghav (Samsung)
2025-06-26 7:19 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250625083704.167993-1-p.raghav@samsung.com \
--to=p.raghav@samsung.com \
--cc=brauner@kernel.org \
--cc=gost.dev@samsung.com \
--cc=jack@suse.cz \
--cc=kernel@pankajraghav.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®