linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Yi <yi.zhang@huaweicloud.com>
To: libaokun@huaweicloud.com, linux-fsdevel@vger.kernel.org
Cc: brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk,
	axboe@kernel.dk, linux-block@vger.kernel.org,
	yangerkun@huawei.com, libaokun1@huawei.com,
	Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH] bdev: add hint prints in sb_set_blocksize() for LBS dependency on THP
Date: Mon, 10 Nov 2025 22:13:26 +0800	[thread overview]
Message-ID: <2b8a6767-5e37-48e1-b75c-cd16005580a7@huaweicloud.com> (raw)
In-Reply-To: <20251110124714.1329978-1-libaokun@huaweicloud.com>

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;


  parent reply	other threads:[~2025-11-10 14:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-11-11  9:43 ` Christian Brauner

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=2b8a6767-5e37-48e1-b75c-cd16005580a7@huaweicloud.com \
    --to=yi.zhang@huaweicloud.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=libaokun1@huawei.com \
    --cc=libaokun@huaweicloud.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yangerkun@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).