btrfs-progs: btrfstune: make uuid rewrite progress more verbose

Signed-off-by: David Sterba <dsterba@suse.cz>
master
David Sterba 2015-06-03 15:24:56 +02:00
parent 551c4bb064
commit e106c695bf
1 changed files with 11 additions and 2 deletions

View File

@ -321,6 +321,7 @@ static int change_uuid(struct btrfs_fs_info *fs_info, const char *new_fsid_str)
{ {
uuid_t new_fsid; uuid_t new_fsid;
uuid_t new_chunk_id; uuid_t new_chunk_id;
uuid_t old_fsid;
char uuid_buf[BTRFS_UUID_UNPARSED_SIZE]; char uuid_buf[BTRFS_UUID_UNPARSED_SIZE];
int ret = 0; int ret = 0;
@ -347,14 +348,20 @@ static int change_uuid(struct btrfs_fs_info *fs_info, const char *new_fsid_str)
fs_info->new_fsid = new_fsid; fs_info->new_fsid = new_fsid;
fs_info->new_chunk_tree_uuid = new_chunk_id; fs_info->new_chunk_tree_uuid = new_chunk_id;
uuid_parse((const char*)fs_info->fsid, old_fsid);
uuid_unparse_upper(old_fsid, uuid_buf);
printf("Current fsid: %s\n", uuid_buf);
uuid_unparse_upper(new_fsid, uuid_buf); uuid_unparse_upper(new_fsid, uuid_buf);
printf("Changing fsid to %s\n", uuid_buf); printf("New fsid: %s\n", uuid_buf);
/* Now we can begin fsid change */ /* Now we can begin fsid change */
printf("Set superblock flag CHANGING_FSID\n");
ret = change_fsid_prepare(fs_info); ret = change_fsid_prepare(fs_info);
if (ret < 0) if (ret < 0)
goto out; goto out;
/* Change extents first */ /* Change extents first */
printf("Change fsid in extents\n");
ret = change_extents_uuid(fs_info); ret = change_extents_uuid(fs_info);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "Failed to change UUID of metadata\n"); fprintf(stderr, "Failed to change UUID of metadata\n");
@ -362,6 +369,7 @@ static int change_uuid(struct btrfs_fs_info *fs_info, const char *new_fsid_str)
} }
/* Then devices */ /* Then devices */
printf("Change fsid on devices\n");
ret = change_devices_uuid(fs_info); ret = change_devices_uuid(fs_info);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "Failed to change UUID of devices\n"); fprintf(stderr, "Failed to change UUID of devices\n");
@ -378,10 +386,11 @@ static int change_uuid(struct btrfs_fs_info *fs_info, const char *new_fsid_str)
goto out; goto out;
/* Now fsid change is done */ /* Now fsid change is done */
printf("Clear superblock flag CHANGING_FSID\n");
ret = change_fsid_done(fs_info); ret = change_fsid_done(fs_info);
fs_info->new_fsid = NULL; fs_info->new_fsid = NULL;
fs_info->new_chunk_tree_uuid = NULL; fs_info->new_chunk_tree_uuid = NULL;
printf("Fsid changed to %s\n", uuid_buf); printf("Fsid change finished\n");
out: out:
return ret; return ret;
} }