Skip to content

Commit 4a89c0b

Browse files
maciejsszmigierogregkh
authored andcommitted
btrfs: don't print information about space cache or tree every remount
[ Upstream commit dbecac2 ] btrfs currently prints information about space cache or free space tree being in use on every remount, regardless whether such remount actually enabled or disabled one of these features. This is actually unnecessary since providing remount options changing the state of these features will explicitly print the appropriate notice. Let's instead print such unconditional information just on an initial mount to avoid filling the kernel log when, for example, laptop-mode-tools remount the fs on some events. Signed-off-by: Maciej S. Szmigiero <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 39a0705 commit 4a89c0b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

fs/btrfs/super.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
574574
int saved_compress_level;
575575
bool saved_compress_force;
576576
int no_compress = 0;
577+
const bool remounting = test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state);
577578

578579
if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
579580
btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE);
@@ -1065,10 +1066,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
10651066
}
10661067
if (!ret)
10671068
ret = btrfs_check_mountopts_zoned(info);
1068-
if (!ret && btrfs_test_opt(info, SPACE_CACHE))
1069-
btrfs_info(info, "disk space caching is enabled");
1070-
if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE))
1071-
btrfs_info(info, "using free space tree");
1069+
if (!ret && !remounting) {
1070+
if (btrfs_test_opt(info, SPACE_CACHE))
1071+
btrfs_info(info, "disk space caching is enabled");
1072+
if (btrfs_test_opt(info, FREE_SPACE_TREE))
1073+
btrfs_info(info, "using free space tree");
1074+
}
10721075
return ret;
10731076
}
10741077

0 commit comments

Comments
 (0)