From: Luis Chamberlain <mcgrof@kernel.org>
To: liwang@redhat.com, brauner@kernel.org, hare@suse.de,
willy@infradead.org, david@fromorbit.com, djwong@kernel.org
Cc: kbusch@kernel.org, john.g.garry@oracle.com, hch@lst.de,
ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org,
linux-block@vger.kernel.org, ltp@lists.linux.it, lkp@intel.com,
oliver.sang@intel.com, oe-lkp@lists.linux.dev,
gost.dev@samsung.com, p.raghav@samsung.com, da.gomez@samsung.com,
kernel@pankajraghav.com, mcgrof@kernel.org
Subject: [PATCH] block: add BLK_FEAT_LBS to check for PAGE_SIZE limit
Date: Tue, 11 Mar 2025 22:00:28 -0700 [thread overview]
Message-ID: <20250312050028.1784117-1-mcgrof@kernel.org> (raw)
The commit titled "block/bdev: lift block size restrictions to 64k"
lifted the block layer's max supported block size to 64k inside the
helper blk_validate_block_size() now that we support large folios on
the block layer. However, block drivers have relied on the call for
queue_limits_commit_update() to validate and ensure the logical block
size < PAGE_SIZE.
We should take time to validate each block driver before enabling
support for larger logical block sizes, so that those that didn't
have support stay that way and don't need modifications.
Li Wang reported this as a regression on LTP via:
testcases/kernel/syscalls/ioctl/ioctl_loop06
Which uses the loopback driver to enable larger logical block sizes
first with LOOP_CONFIGURE and then LOOP_SET_BLOCK_SIZE. While
I see no reason why the loopback block driver can't support
larger logical block sizes than PAGE_SIZE, leave this validation
step as a secondary effort for each block driver.
Reported-by: Li Wang <liwang@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202503101538.84c33cd4-lkp@intel.com
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
block/blk-settings.c | 4 +++-
include/linux/blkdev.h | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index c44dadc35e1e..5cdd0d7d2af2 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -254,7 +254,9 @@ int blk_validate_limits(struct queue_limits *lim)
*/
if (!lim->logical_block_size)
lim->logical_block_size = SECTOR_SIZE;
- else if (blk_validate_block_size(lim->logical_block_size)) {
+ else if (blk_validate_block_size(lim->logical_block_size) ||
+ (lim->logical_block_size > PAGE_SIZE &&
+ !(lim->features & BLK_FEAT_LBS))) {
pr_warn("Invalid logical block size (%d)\n", lim->logical_block_size);
return -EINVAL;
}
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a97428e8bbbe..cdab3731a646 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -341,6 +341,9 @@ typedef unsigned int __bitwise blk_features_t;
#define BLK_FEAT_ATOMIC_WRITES \
((__force blk_features_t)(1u << 16))
+/* Supports sector sizes > PAGE_SIZE */
+#define BLK_FEAT_LBS ((__force blk_features_t)(1u << 17))
+
/*
* Flags automatically inherited when stacking limits.
*/
--
2.47.2
next reply other threads:[~2025-03-12 5:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 5:00 Luis Chamberlain [this message]
2025-03-12 5:21 ` [PATCH] block: add BLK_FEAT_LBS to check for PAGE_SIZE limit Christoph Hellwig
2025-03-12 5:37 ` Luis Chamberlain
2025-03-12 5:40 ` Christoph Hellwig
2025-03-12 5:44 ` Luis Chamberlain
[not found] ` <CAEemH2du_ULgnX19YnCiAJnCNzAURW0R17Tgxpdy9tg-XzisHQ@mail.gmail.com>
2025-03-12 13:59 ` Christoph Hellwig
[not found] ` <CAEemH2c_S_KMMQcyAp702N0DDBWrqOVxgz6GeS=RfVrUCJFE1Q@mail.gmail.com>
2025-03-13 8:26 ` Hannes Reinecke
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=20250312050028.1784117-1-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=brauner@kernel.org \
--cc=da.gomez@samsung.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=gost.dev@samsung.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=kbusch@kernel.org \
--cc=kernel@pankajraghav.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=liwang@redhat.com \
--cc=lkp@intel.com \
--cc=ltp@lists.linux.it \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=p.raghav@samsung.com \
--cc=ritesh.list@gmail.com \
--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