Skip to content

Commit dbecac2

Browse files
maciejsszmigierokdave
authored andcommitted
btrfs: don't print information about space cache or tree every remount
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]>
1 parent 1fdbd03 commit dbecac2

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
@@ -626,6 +626,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
626626
int saved_compress_level;
627627
bool saved_compress_force;
628628
int no_compress = 0;
629+
const bool remounting = test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state);
629630

630631
if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
631632
btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE);
@@ -1137,10 +1138,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
11371138
}
11381139
if (!ret)
11391140
ret = btrfs_check_mountopts_zoned(info);
1140-
if (!ret && btrfs_test_opt(info, SPACE_CACHE))
1141-
btrfs_info(info, "disk space caching is enabled");
1142-
if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE))
1143-
btrfs_info(info, "using free space tree");
1141+
if (!ret && !remounting) {
1142+
if (btrfs_test_opt(info, SPACE_CACHE))
1143+
btrfs_info(info, "disk space caching is enabled");
1144+
if (btrfs_test_opt(info, FREE_SPACE_TREE))
1145+
btrfs_info(info, "using free space tree");
1146+
}
11441147
return ret;
11451148
}
11461149

0 commit comments

Comments
 (0)