* [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP
@ 2025-11-10 12:47 libaokun
2025-11-10 13:15 ` Jan Kara
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: libaokun @ 2025-11-10 12:47 UTC (permalink / raw)
To: linux-fsdevel
Cc: brauner, jack, viro, axboe, linux-block, yi.zhang, yangerkun,
libaokun1, libaokun, Theodore Ts'o
From: Baokun Li <libaokun1@huawei.com>
Support for block sizes greater than the page size depends on large
folios, which in turn require CONFIG_TRANSPARENT_HUGEPAGE to be enabled.
Because the code is wrapped in multiple layers of abstraction, this
dependency is rather obscure, so users may not realize it and may be
unsure how to enable LBS.
As suggested by Theodore, I have added hint messages in sb_set_blocksize
so that users can distinguish whether a mount failure with block size
larger than page size is due to lack of filesystem support or the absence
of CONFIG_TRANSPARENT_HUGEPAGE.
Suggested-by: Theodore Ts'o <tytso@mit.edu>
Link: https://patch.msgid.link/20251110043226.GD2988753@mit.edu
Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
block/bdev.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/block/bdev.c b/block/bdev.c
index 810707cca970..4888831acaf5 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -217,9 +217,26 @@ int set_blocksize(struct file *file, int size)
EXPORT_SYMBOL(set_blocksize);
+static int sb_validate_large_blocksize(struct super_block *sb, int size)
+{
+ const char *err_str = NULL;
+
+ if (!(sb->s_type->fs_flags & FS_LBS))
+ err_str = "not supported by filesystem";
+ else if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
+ err_str = "is only supported with CONFIG_TRANSPARENT_HUGEPAGE";
+
+ if (!err_str)
+ return 0;
+
+ pr_warn_ratelimited("%s: block size(%d) > page size(%lu) %s\n",
+ sb->s_type->name, size, PAGE_SIZE, err_str);
+ return -EINVAL;
+}
+
int sb_set_blocksize(struct super_block *sb, int size)
{
- if (!(sb->s_type->fs_flags & FS_LBS) && size > PAGE_SIZE)
+ if (size > PAGE_SIZE && sb_validate_large_blocksize(sb, size))
return 0;
if (set_blocksize(sb->s_bdev_file, size))
return 0;
--
2.46.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP
2025-11-10 12:47 [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP libaokun
@ 2025-11-10 13:15 ` Jan Kara
2025-11-10 14:13 ` Zhang Yi
2025-11-11 9:43 ` Christian Brauner
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2025-11-10 13:15 UTC (permalink / raw)
To: libaokun
Cc: linux-fsdevel, brauner, jack, viro, axboe, linux-block, yi.zhang,
yangerkun, libaokun1, Theodore Ts'o
On Mon 10-11-25 20:47:14, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
>
> Support for block sizes greater than the page size depends on large
> folios, which in turn require CONFIG_TRANSPARENT_HUGEPAGE to be enabled.
>
> Because the code is wrapped in multiple layers of abstraction, this
> dependency is rather obscure, so users may not realize it and may be
> unsure how to enable LBS.
>
> As suggested by Theodore, I have added hint messages in sb_set_blocksize
> so that users can distinguish whether a mount failure with block size
> larger than page size is due to lack of filesystem support or the absence
> of CONFIG_TRANSPARENT_HUGEPAGE.
>
> Suggested-by: Theodore Ts'o <tytso@mit.edu>
> Link: https://patch.msgid.link/20251110043226.GD2988753@mit.edu
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> block/bdev.c | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/block/bdev.c b/block/bdev.c
> index 810707cca970..4888831acaf5 100644
> --- a/block/bdev.c
> +++ b/block/bdev.c
> @@ -217,9 +217,26 @@ int set_blocksize(struct file *file, int size)
>
> EXPORT_SYMBOL(set_blocksize);
>
> +static int sb_validate_large_blocksize(struct super_block *sb, int size)
> +{
> + const char *err_str = NULL;
> +
> + if (!(sb->s_type->fs_flags & FS_LBS))
> + err_str = "not supported by filesystem";
> + else if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> + err_str = "is only supported with CONFIG_TRANSPARENT_HUGEPAGE";
> +
> + if (!err_str)
> + return 0;
> +
> + pr_warn_ratelimited("%s: block size(%d) > page size(%lu) %s\n",
> + sb->s_type->name, size, PAGE_SIZE, err_str);
> + return -EINVAL;
> +}
> +
> int sb_set_blocksize(struct super_block *sb, int size)
> {
> - if (!(sb->s_type->fs_flags & FS_LBS) && size > PAGE_SIZE)
> + if (size > PAGE_SIZE && sb_validate_large_blocksize(sb, size))
> return 0;
> if (set_blocksize(sb->s_bdev_file, size))
> return 0;
> --
> 2.46.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP
2025-11-10 12:47 [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP libaokun
2025-11-10 13:15 ` Jan Kara
@ 2025-11-10 14:13 ` Zhang Yi
2025-11-11 9:43 ` Christian Brauner
2 siblings, 0 replies; 4+ messages in thread
From: Zhang Yi @ 2025-11-10 14:13 UTC (permalink / raw)
To: libaokun, linux-fsdevel
Cc: brauner, jack, viro, axboe, linux-block, yangerkun, libaokun1,
Theodore Ts'o
On 11/10/2025 8:47 PM, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
>
> Support for block sizes greater than the page size depends on large
> folios, which in turn require CONFIG_TRANSPARENT_HUGEPAGE to be enabled.
>
> Because the code is wrapped in multiple layers of abstraction, this
> dependency is rather obscure, so users may not realize it and may be
> unsure how to enable LBS.
>
> As suggested by Theodore, I have added hint messages in sb_set_blocksize
> so that users can distinguish whether a mount failure with block size
> larger than page size is due to lack of filesystem support or the absence
> of CONFIG_TRANSPARENT_HUGEPAGE.
>
> Suggested-by: Theodore Ts'o <tytso@mit.edu>
> Link: https://patch.msgid.link/20251110043226.GD2988753@mit.edu
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
Looks good to me.
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
> ---
> block/bdev.c | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/block/bdev.c b/block/bdev.c
> index 810707cca970..4888831acaf5 100644
> --- a/block/bdev.c
> +++ b/block/bdev.c
> @@ -217,9 +217,26 @@ int set_blocksize(struct file *file, int size)
>
> EXPORT_SYMBOL(set_blocksize);
>
> +static int sb_validate_large_blocksize(struct super_block *sb, int size)
> +{
> + const char *err_str = NULL;
> +
> + if (!(sb->s_type->fs_flags & FS_LBS))
> + err_str = "not supported by filesystem";
> + else if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> + err_str = "is only supported with CONFIG_TRANSPARENT_HUGEPAGE";
> +
> + if (!err_str)
> + return 0;
> +
> + pr_warn_ratelimited("%s: block size(%d) > page size(%lu) %s\n",
> + sb->s_type->name, size, PAGE_SIZE, err_str);
> + return -EINVAL;
> +}
> +
> int sb_set_blocksize(struct super_block *sb, int size)
> {
> - if (!(sb->s_type->fs_flags & FS_LBS) && size > PAGE_SIZE)
> + if (size > PAGE_SIZE && sb_validate_large_blocksize(sb, size))
> return 0;
> if (set_blocksize(sb->s_bdev_file, size))
> return 0;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP
2025-11-10 12:47 [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP libaokun
2025-11-10 13:15 ` Jan Kara
2025-11-10 14:13 ` Zhang Yi
@ 2025-11-11 9:43 ` Christian Brauner
2 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2025-11-11 9:43 UTC (permalink / raw)
To: linux-fsdevel, libaokun
Cc: Christian Brauner, jack, viro, axboe, linux-block, yi.zhang,
yangerkun, libaokun1, Theodore Ts'o
On Mon, 10 Nov 2025 20:47:14 +0800, libaokun@huaweicloud.com wrote:
> Support for block sizes greater than the page size depends on large
> folios, which in turn require CONFIG_TRANSPARENT_HUGEPAGE to be enabled.
>
> Because the code is wrapped in multiple layers of abstraction, this
> dependency is rather obscure, so users may not realize it and may be
> unsure how to enable LBS.
>
> [...]
Applied to the vfs-6.19.misc branch of the vfs/vfs.git tree.
Patches in the vfs-6.19.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.19.misc
[1/1] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP
https://git.kernel.org/vfs/vfs/c/5382107fad9b
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-11 9:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 12:47 [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP libaokun
2025-11-10 13:15 ` Jan Kara
2025-11-10 14:13 ` Zhang Yi
2025-11-11 9:43 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).