btrfs-progs: tune: fix typos and mistakes in messages

The conversion have been copy&pasted from one code but not all messages
reflect that and mistakenly say fsid instead of csum, etc. Also rename
functions converting the trees to more descriptive names.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-02-15 20:04:06 +01:00
parent 85f49ce2cd
commit 79b3ed9ab8
5 changed files with 19 additions and 18 deletions

View File

@ -62,7 +62,7 @@ out:
return ret;
}
static int change_extents_csum(struct btrfs_fs_info *fs_info, int csum_type)
static int change_extent_tree_csum(struct btrfs_fs_info *fs_info, int csum_type)
{
struct btrfs_root *root = btrfs_extent_root(fs_info, 0);
struct btrfs_path path;
@ -123,7 +123,7 @@ out:
return ret;
}
static int change_devices_csum(struct btrfs_root *root, int csum_type)
static int change_chunk_tree_csum(struct btrfs_root *root, int csum_type)
{
struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_path path;
@ -275,10 +275,14 @@ int rewrite_checksums(struct btrfs_root *root, int csum_type)
/* FIXME: Sanity checks */
if (0) {
error("UUID rewrite in progress, cannot change fsid");
error("UUID rewrite in progress, cannot change csum");
return 1;
}
pr_verbose(LOG_DEFAULT, "Change csum from %s to %s\n",
btrfs_super_csum_name(fs_info->csum_type),
btrfs_super_csum_name(csum_type));
fs_info->force_csum_type = csum_type;
/* Step 1 sets the in progress flag, no other change to the sb */
@ -291,8 +295,8 @@ int rewrite_checksums(struct btrfs_root *root, int csum_type)
return ret;
/* Change extents first */
pr_verbose(LOG_DEFAULT, "Change fsid in extents\n");
ret = change_extents_csum(fs_info, csum_type);
pr_verbose(LOG_DEFAULT, "Change csum in extent tree\n");
ret = change_extent_tree_csum(fs_info, csum_type);
if (ret < 0) {
error("failed to change csum of metadata: %d", ret);
goto out;
@ -300,7 +304,7 @@ int rewrite_checksums(struct btrfs_root *root, int csum_type)
/* Then devices */
pr_verbose(LOG_DEFAULT, "Change csum in chunk tree\n");
ret = change_devices_csum(fs_info->chunk_root, csum_type);
ret = change_chunk_tree_csum(fs_info->chunk_root, csum_type);
if (ret < 0) {
error("failed to change UUID of devices: %d", ret);
goto out;
@ -312,7 +316,7 @@ int rewrite_checksums(struct btrfs_root *root, int csum_type)
if (ret < 0)
goto out;
/* Last, change fsid in super */
/* Last, change csum in super */
ret = write_all_supers(fs_info);
if (ret < 0)
goto out;

View File

@ -46,7 +46,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *uuid_string)
}
if (check_unfinished_fsid_change(root->fs_info, unused1, unused2)) {
error("UUID rewrite in progress, cannot change fsid");
error("UUID rewrite in progress, cannot change metadata_uuid");
return 1;
}
@ -110,4 +110,3 @@ int set_metadata_uuid(struct btrfs_root *root, const char *uuid_string)
return btrfs_commit_transaction(trans, root);
}

View File

@ -78,7 +78,7 @@ static int change_buffer_header_uuid(struct extent_buffer *eb, uuid_t new_fsid)
return ret;
}
static int change_extents_uuid(struct btrfs_fs_info *fs_info, uuid_t new_fsid)
static int change_extent_tree_uuid(struct btrfs_fs_info *fs_info, uuid_t new_fsid)
{
struct btrfs_root *root = btrfs_extent_root(fs_info, 0);
struct btrfs_path path;
@ -159,7 +159,7 @@ static int change_device_uuid(struct extent_buffer *eb, int slot,
return ret;
}
static int change_devices_uuid(struct btrfs_root *root, uuid_t new_fsid)
static int change_chunk_tree_uuid(struct btrfs_root *root, uuid_t new_fsid)
{
struct btrfs_path path;
struct btrfs_key key = {0, 0, 0};
@ -275,16 +275,16 @@ int change_uuid(struct btrfs_fs_info *fs_info, const char *new_fsid_str)
goto out;
/* Change extents first */
pr_verbose(LOG_DEFAULT, "Change fsid in extents\n");
ret = change_extents_uuid(fs_info, new_fsid);
pr_verbose(LOG_DEFAULT, "Change fsid in extent tree\n");
ret = change_extent_tree_uuid(fs_info, new_fsid);
if (ret < 0) {
error("failed to change UUID of metadata: %d", ret);
goto out;
}
/* Then devices */
pr_verbose(LOG_DEFAULT, "Change fsid on devices\n");
ret = change_devices_uuid(fs_info->chunk_root, new_fsid);
pr_verbose(LOG_DEFAULT, "Change fsid in chunk tree\n");
ret = change_chunk_tree_uuid(fs_info->chunk_root, new_fsid);
if (ret < 0) {
error("failed to change UUID of devices: %d", ret);
goto out;

View File

@ -88,7 +88,7 @@ iterate_bgs:
}
ce = prev_cache_extent(ce);
if (!ce) {
error("no more block group before bytenr %llu",
error("no more block groups before bytenr %llu",
fs_info->last_converted_bg_bytenr);
ret = -ENOENT;
goto error;

View File

@ -179,8 +179,6 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
"Switching checksums is experimental, do not use for valuable data!");
ctree_flags |= OPEN_CTREE_SKIP_CSUM_CHECK;
csum_type = parse_csum_type(optarg);
pr_verbose(LOG_DEFAULT, "Switch csum to %s\n",
btrfs_super_csum_name(csum_type));
break;
#endif
case GETOPT_VAL_HELP: