public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: restore mount option info messages during mount
@ 2025-07-28  2:07 sawara04.o
  2025-08-07 18:23 ` David Sterba
  2025-08-08 14:56 ` David Sterba
  0 siblings, 2 replies; 6+ messages in thread
From: sawara04.o @ 2025-07-28  2:07 UTC (permalink / raw)
  To: clm, josef, dsterba, johannes.thumshirn, brauner
  Cc: Kyoji Ogasawara, linux-btrfs

From: Kyoji Ogasawara <sawara04.o@gmail.com>

After the fsconfig migration, mount option info messages are no longer
displayed during mount operations because btrfs_emit_options() is only
called during remount, not during initial mount.

Fix this by calling btrfs_emit_options() in btrfs_fill_super() after
open_ctree() succeeds. Additionally, prevent log duplication by ensuring
btrfs_check_options() handles validation with warn-level and err-level
messages, while btrfs_emit_options() provides info-level messages.

Fixes: eddb1a433f26 ("btrfs: add reconfigure callback for fs_context")
Signed-off-by: Kyoji Ogasawara <sawara04.o@gmail.com>
---
 fs/btrfs/super.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index a0c65adce1ab..de4e01abc599 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -88,6 +88,9 @@ struct btrfs_fs_context {
 	refcount_t refs;
 };
 
+static void btrfs_emit_options(struct btrfs_fs_info *info,
+			       struct btrfs_fs_context *old);
+
 enum {
 	Opt_acl,
 	Opt_clear_cache,
@@ -689,12 +692,9 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,
 
 	if (!test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state)) {
 		if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) {
-			btrfs_info(info, "disk space caching is enabled");
 			btrfs_warn(info,
 "space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2");
 		}
-		if (btrfs_raw_test_opt(*mount_opt, FREE_SPACE_TREE))
-			btrfs_info(info, "using free-space-tree");
 	}
 
 	return ret;
@@ -971,6 +971,8 @@ static int btrfs_fill_super(struct super_block *sb,
 		return err;
 	}
 
+	btrfs_emit_options(fs_info, NULL);
+
 	inode = btrfs_iget(BTRFS_FIRST_FREE_OBJECTID, fs_info->fs_root);
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
@@ -1428,7 +1430,6 @@ static void btrfs_emit_options(struct btrfs_fs_info *info,
 {
 	btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
 	btrfs_info_if_set(info, old, DEGRADED, "allowing degraded mounts");
-	btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
 	btrfs_info_if_set(info, old, SSD, "enabling ssd optimizations");
 	btrfs_info_if_set(info, old, SSD_SPREAD, "using spread ssd allocation scheme");
 	btrfs_info_if_set(info, old, NOBARRIER, "turning off barriers");
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs: restore mount option info messages during mount
  2025-07-28  2:07 [PATCH] btrfs: restore mount option info messages during mount sawara04.o
@ 2025-08-07 18:23 ` David Sterba
  2025-08-07 19:04   ` Kyoji Ogasawara
  2025-08-08 14:56 ` David Sterba
  1 sibling, 1 reply; 6+ messages in thread
From: David Sterba @ 2025-08-07 18:23 UTC (permalink / raw)
  To: sawara04.o; +Cc: clm, josef, dsterba, johannes.thumshirn, brauner, linux-btrfs

On Mon, Jul 28, 2025 at 11:07:18AM +0900, sawara04.o@gmail.com wrote:
> From: Kyoji Ogasawara <sawara04.o@gmail.com>
> 
> After the fsconfig migration, mount option info messages are no longer
> displayed during mount operations because btrfs_emit_options() is only
> called during remount, not during initial mount.

I see messages at first mount that I'd expect to see:

[625.459381] BTRFS info (device vda): first mount of filesystem bca4e1c1-9ca9-441c-8a6a-7004e31763bf
[625.460384] BTRFS info (device vda): using crc32c (crc32c-generic) checksum algorithm
[625.461192] BTRFS info (device vda): using free-space-tree

is there anything specific in your test other than mkfs and mount?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs: restore mount option info messages during mount
  2025-08-07 18:23 ` David Sterba
@ 2025-08-07 19:04   ` Kyoji Ogasawara
  0 siblings, 0 replies; 6+ messages in thread
From: Kyoji Ogasawara @ 2025-08-07 19:04 UTC (permalink / raw)
  To: dsterba; +Cc: clm, josef, dsterba, johannes.thumshirn, brauner, linux-btrfs

> > After the fsconfig migration, mount option info messages are no longer
> > displayed during mount operations because btrfs_emit_options() is only
> > called during remount, not during initial mount.
>
> I see messages at first mount that I'd expect to see:
>
> [625.459381] BTRFS info (device vda): first mount of filesystem bca4e1c1-9ca9-441c-8a6a-7004e31763bf
> [625.460384] BTRFS info (device vda): using crc32c (crc32c-generic) checksum algorithm
> [625.461192] BTRFS info (device vda): using free-space-tree
>
> is there anything specific in your test other than mkfs and mount?

No, not really. I've only tested the mkfs and mount operations.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs: restore mount option info messages during mount
  2025-07-28  2:07 [PATCH] btrfs: restore mount option info messages during mount sawara04.o
  2025-08-07 18:23 ` David Sterba
@ 2025-08-08 14:56 ` David Sterba
  2025-08-11  8:08   ` Kyoji Ogasawara
  1 sibling, 1 reply; 6+ messages in thread
From: David Sterba @ 2025-08-08 14:56 UTC (permalink / raw)
  To: sawara04.o; +Cc: clm, josef, dsterba, johannes.thumshirn, brauner, linux-btrfs

On Mon, Jul 28, 2025 at 11:07:18AM +0900, sawara04.o@gmail.com wrote:
> From: Kyoji Ogasawara <sawara04.o@gmail.com>
> 
> After the fsconfig migration, mount option info messages are no longer
> displayed during mount operations because btrfs_emit_options() is only
> called during remount, not during initial mount.
> 
> Fix this by calling btrfs_emit_options() in btrfs_fill_super() after
> open_ctree() succeeds. Additionally, prevent log duplication by ensuring
> btrfs_check_options() handles validation with warn-level and err-level
> messages, while btrfs_emit_options() provides info-level messages.
> 
> Fixes: eddb1a433f26 ("btrfs: add reconfigure callback for fs_context")
> Signed-off-by: Kyoji Ogasawara <sawara04.o@gmail.com>

You're right, the options are not printed.

> ---
>  fs/btrfs/super.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index a0c65adce1ab..de4e01abc599 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -88,6 +88,9 @@ struct btrfs_fs_context {
>  	refcount_t refs;
>  };
>  
> +static void btrfs_emit_options(struct btrfs_fs_info *info,
> +			       struct btrfs_fs_context *old);
> +
>  enum {
>  	Opt_acl,
>  	Opt_clear_cache,
> @@ -689,12 +692,9 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,
>  
>  	if (!test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state)) {
>  		if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) {
> -			btrfs_info(info, "disk space caching is enabled");
>  			btrfs_warn(info,
>  "space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2");
>  		}
> -		if (btrfs_raw_test_opt(*mount_opt, FREE_SPACE_TREE))
> -			btrfs_info(info, "using free-space-tree");
>  	}
>  
>  	return ret;
> @@ -971,6 +971,8 @@ static int btrfs_fill_super(struct super_block *sb,
>  		return err;
>  	}
>  
> +	btrfs_emit_options(fs_info, NULL);
> +
>  	inode = btrfs_iget(BTRFS_FIRST_FREE_OBJECTID, fs_info->fs_root);
>  	if (IS_ERR(inode)) {
>  		err = PTR_ERR(inode);
> @@ -1428,7 +1430,6 @@ static void btrfs_emit_options(struct btrfs_fs_info *info,
>  {
>  	btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
>  	btrfs_info_if_set(info, old, DEGRADED, "allowing degraded mounts");
> -	btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");

Shouldn't this rather be NODATACOW? The logic around the option is the
same as for NODATASUM, but for some reason NODATACOW is under
btrfs_info_if_unset() call.

>  	btrfs_info_if_set(info, old, SSD, "enabling ssd optimizations");
>  	btrfs_info_if_set(info, old, SSD_SPREAD, "using spread ssd allocation scheme");
>  	btrfs_info_if_set(info, old, NOBARRIER, "turning off barriers");
> -- 
> 2.50.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs: restore mount option info messages during mount
  2025-08-08 14:56 ` David Sterba
@ 2025-08-11  8:08   ` Kyoji Ogasawara
  2025-08-12 11:31     ` David Sterba
  0 siblings, 1 reply; 6+ messages in thread
From: Kyoji Ogasawara @ 2025-08-11  8:08 UTC (permalink / raw)
  To: dsterba; +Cc: clm, josef, dsterba, johannes.thumshirn, brauner, linux-btrfs

> > @@ -1428,7 +1430,6 @@ static void btrfs_emit_options(struct btrfs_fs_info *info,
> >  {
> >       btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
> >       btrfs_info_if_set(info, old, DEGRADED, "allowing degraded mounts");
> > -     btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
>
> Shouldn't this rather be NODATACOW? The logic around the option is the
> same as for NODATASUM, but for some reason NODATACOW is under
> btrfs_info_if_unset() call.
>
> >       btrfs_info_if_set(info, old, SSD, "enabling ssd optimizations");
> >       btrfs_info_if_set(info, old, SSD_SPREAD, "using spread ssd allocation scheme");
> >       btrfs_info_if_set(info, old, NOBARRIER, "turning off barriers");
> > --
> > 2.50.1
> >

Thank you for your suggestion.
I'll update the code to handle NODATASUM similarly to NODATACOW.

=====
btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
btrfs_info_if_set(info, old, DEGRADED, "allowing degraded mounts");
btrfs_info_if_set(info, old, NODATACOW, "setting nodatacow");
...
btrfs_info_if_unset(info, old, NODATASUM, "setting datasum");
btrfs_info_if_unset(info, old, NODATACOW, "setting datacow");
=====

Let me know if there's anything else I should consider.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs: restore mount option info messages during mount
  2025-08-11  8:08   ` Kyoji Ogasawara
@ 2025-08-12 11:31     ` David Sterba
  0 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2025-08-12 11:31 UTC (permalink / raw)
  To: Kyoji Ogasawara
  Cc: clm, josef, dsterba, johannes.thumshirn, brauner, linux-btrfs

On Mon, Aug 11, 2025 at 05:08:39PM +0900, Kyoji Ogasawara wrote:
> > > @@ -1428,7 +1430,6 @@ static void btrfs_emit_options(struct btrfs_fs_info *info,
> > >  {
> > >       btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
> > >       btrfs_info_if_set(info, old, DEGRADED, "allowing degraded mounts");
> > > -     btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
> >
> > Shouldn't this rather be NODATACOW? The logic around the option is the
> > same as for NODATASUM, but for some reason NODATACOW is under
> > btrfs_info_if_unset() call.
> >
> > >       btrfs_info_if_set(info, old, SSD, "enabling ssd optimizations");
> > >       btrfs_info_if_set(info, old, SSD_SPREAD, "using spread ssd allocation scheme");
> > >       btrfs_info_if_set(info, old, NOBARRIER, "turning off barriers");
> > > --
> > > 2.50.1
> > >
> 
> Thank you for your suggestion.
> I'll update the code to handle NODATASUM similarly to NODATACOW.
> 
> =====
> btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
> btrfs_info_if_set(info, old, DEGRADED, "allowing degraded mounts");
> btrfs_info_if_set(info, old, NODATACOW, "setting nodatacow");
> ...
> btrfs_info_if_unset(info, old, NODATASUM, "setting datasum");
> btrfs_info_if_unset(info, old, NODATACOW, "setting datacow");
> =====
> 
> Let me know if there's anything else I should consider.

I haven't seen other problems in the mount options. Please send the
fixes as separate patches. Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-12 11:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28  2:07 [PATCH] btrfs: restore mount option info messages during mount sawara04.o
2025-08-07 18:23 ` David Sterba
2025-08-07 19:04   ` Kyoji Ogasawara
2025-08-08 14:56 ` David Sterba
2025-08-11  8:08   ` Kyoji Ogasawara
2025-08-12 11:31     ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox