mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-17 20:05:24 +00:00
btrfs-progs: remove redundant fs uuid validation from make_btrfs
cfg->fs_uuid is either 0 or set to the value of the -U parameter passed to mkfs.btrfs. However the value of the latter is already being validated in the main mkfs function. Just remove the duplicated checks in make_btrfs as they effectively can never be executed. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
433321ee8f
commit
f59a229d2c
@ -260,20 +260,11 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg)
|
||||
memset(&super, 0, sizeof(super));
|
||||
|
||||
num_bytes = (cfg->num_bytes / cfg->sectorsize) * cfg->sectorsize;
|
||||
if (*cfg->fs_uuid) {
|
||||
if (uuid_parse(cfg->fs_uuid, super.fsid) != 0) {
|
||||
error("cannot not parse UUID: %s", cfg->fs_uuid);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (!test_uuid_unique(cfg->fs_uuid)) {
|
||||
error("non-unique UUID: %s", cfg->fs_uuid);
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
if (!*cfg->fs_uuid) {
|
||||
uuid_generate(super.fsid);
|
||||
uuid_unparse(super.fsid, cfg->fs_uuid);
|
||||
} else {
|
||||
uuid_parse(cfg->fs_uuid, super.fsid);
|
||||
}
|
||||
uuid_generate(super.dev_item.uuid);
|
||||
uuid_generate(chunk_tree_uuid);
|
||||
|
Loading…
Reference in New Issue
Block a user