Skip to contentSkip to conversation

Fix and unify mount option log messages

PATCH In review [email protected] 3 participants 5 messages Aug 12, 2025 – Aug 13, 2025 Btrfs file system

lore
Share & tools
lore
#0 lore raw

v2 cover Fix and unify mount option log messages

From: Kyoji Ogasawara <[email protected]>

This patch series fixes and unifies the log messages related to btrfs mount options.

The first patch addresses a regression where mount option messages were no longer displayed during initial mounts after the fsconfig migration.

The second patch unifies the log messages for NODATACOW and NODATASUM options, which were being handled with the same logic but had inconsistent and duplicate messages.

Thanks,
Kyoji

Kyoji Ogasawara (2):
btrfs: restore mount option info messages during mount
btrfs: Align log messages and fix duplicates for NODATACOW/NODATASUM

 fs/btrfs/super.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH v2 1/2 btrfs: restore mount option info messages during mount

From: Kyoji Ogasawara <[email protected]>

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")
---
 fs/btrfs/super.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
fs/btrfs/super.c +5 -3
index a0c65adce1ab..2677754ec8f7 100644
@@ -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);
Signature · 1 line
2.50.1
#2 lore raw

PATCH v2 2/2 btrfs: Align log messages and fix duplicates for NODATACOW/NODATASUM

In reply to [email protected]

From: Kyoji Ogasawara <[email protected]>

Fix duplicate log messages and make them the same as the log output messages related to NODATACOW and NODATASUM, which are output with the same logic.

Fixes eddb1a433f26 ("btrfs: add reconfigure callback for fs_context")
---
 fs/btrfs/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/super.c +2 -1
index 2677754ec8f7..76c2618b427c 100644
@@ -1430,7 +1430,7 @@ 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, NODATACOW, "setting nodatacow");
 	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");
@@ -1452,6 +1452,7 @@ static void btrfs_emit_options(struct btrfs_fs_info *info,
 	btrfs_info_if_set(info, old, IGNOREMETACSUMS, "ignoring meta csums");
 	btrfs_info_if_set(info, old, IGNORESUPERFLAGS, "ignoring unknown super block flags");
 
+	btrfs_info_if_unset(info, old, NODATASUM, "setting datasum");
 	btrfs_info_if_unset(info, old, NODATACOW, "setting datacow");
 	btrfs_info_if_unset(info, old, SSD, "not using ssd optimizations");
 	btrfs_info_if_unset(info, old, SSD_SPREAD, "not using spread ssd allocation scheme");
Signature · 1 line
2.50.1
Reviewed-by on the v2 series
#3 lore raw
In reply to [email protected]
Quoted 11 lines · 在 2025/8/13 03:30, [email protected] 写道:

From: Kyoji Ogasawara <[email protected]>

This patch series fixes and unifies the log messages related to btrfs mount options.

The first patch addresses a regression where mount option messages were no longer displayed during initial mounts after the fsconfig migration.

The second patch unifies the log messages for NODATACOW and NODATASUM options, which were being handled with the same logic but had inconsistent and duplicate messages.

Thanks,
Qu

Quoted 11 lines

Thanks,
Kyoji

Kyoji Ogasawara (2):
btrfs: restore mount option info messages during mount
btrfs: Align log messages and fix duplicates for NODATACOW/NODATASUM

  fs/btrfs/super.c | 11 +++++++----
  1 file changed, 7 insertions(+), 4 deletions(-)
#4 lore raw
In reply to [email protected]
Quoted 12 lines · On Wed, Aug 13, 2025 at 03:00:05AM +0900, [email protected] wrote:

From: Kyoji Ogasawara <[email protected]>

This patch series fixes and unifies the log messages related to btrfs mount options.

The first patch addresses a regression where mount option messages were no longer displayed during initial mounts after the fsconfig migration.

The second patch unifies the log messages for NODATACOW and NODATASUM options, which were being handled with the same logic but had inconsistent and duplicate messages.

Quoted 6 lines

Thanks,
Kyoji

Kyoji Ogasawara (2):
btrfs: restore mount option info messages during mount
btrfs: Align log messages and fix duplicates for NODATACOW/NODATASUM

Added to for-next, thanks.