mirror of https://github.com/kdave/btrfs-progs synced 2024-12-31 18:52:05 +00:00

btrfs-progs: tune: rename new_uuid to new_fsid in set_metadata_uuid

%new_uuid is being used to say there is a new fsid. So why not just call
it %new_fsid.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2023-08-14 23:28:01 +08:00 committed by David Sterba
parent 21440a64f7
commit c6ecbe54bf

View File

@ -29,7 +29,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
struct btrfs_super_block *disk_super; struct btrfs_super_block *disk_super;
uuid_t fsid, unused1, unused2; uuid_t fsid, unused1, unused2;
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
bool new_uuid = true; bool new_fsid = true;
u64 incompat_flags; u64 incompat_flags;
bool uuid_changed; bool uuid_changed;
u64 super_flags; u64 super_flags;
@ -55,7 +55,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
else else
uuid_generate(fsid); uuid_generate(fsid);
new_uuid = (memcmp(fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0); new_fsid = (memcmp(fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0);
/* Step 1 sets the in progress flag */ /* Step 1 sets the in progress flag */
trans = btrfs_start_transaction(root, 1); trans = btrfs_start_transaction(root, 1);
@ -65,7 +65,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (new_uuid && uuid_changed && memcmp(disk_super->metadata_uuid, if (new_fsid && uuid_changed && memcmp(disk_super->metadata_uuid,
fsid, BTRFS_FSID_SIZE) == 0) { fsid, BTRFS_FSID_SIZE) == 0) {
/* /*
* Changing fsid to be the same as metadata uuid, so just * Changing fsid to be the same as metadata uuid, so just
@ -75,7 +75,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
incompat_flags &= ~BTRFS_FEATURE_INCOMPAT_METADATA_UUID; incompat_flags &= ~BTRFS_FEATURE_INCOMPAT_METADATA_UUID;
btrfs_set_super_incompat_flags(disk_super, incompat_flags); btrfs_set_super_incompat_flags(disk_super, incompat_flags);
memset(disk_super->metadata_uuid, 0, BTRFS_FSID_SIZE); memset(disk_super->metadata_uuid, 0, BTRFS_FSID_SIZE);
} else if (new_uuid && uuid_changed && memcmp(disk_super->metadata_uuid, } else if (new_fsid && uuid_changed && memcmp(disk_super->metadata_uuid,
fsid, BTRFS_FSID_SIZE)) { fsid, BTRFS_FSID_SIZE)) {
/* /*
* Changing fsid on an already changed FS, in this case we * Changing fsid on an already changed FS, in this case we
@ -83,7 +83,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
* has already the correct value * has already the correct value
*/ */
memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE); memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE);
} else if (new_uuid && !uuid_changed) { } else if (new_fsid && !uuid_changed) {
/* /*
* First time changing the fsid, copy the fsid to metadata_uuid * First time changing the fsid, copy the fsid to metadata_uuid
*/ */