Skip to content

Commit

Permalink
btrfs: merge calls to alloc_fs_devices in device_list_add
Browse files Browse the repository at this point in the history
Simplify has_metadata_uuid checks - by localizing the has_metadata_uuid
checked within alloc_fs_devices()'s second argument, it improves the
code readability.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Anand Jain authored and David Sterba committed Jun 19, 2023
1 parent 19c4c49 commit c6930d7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,12 +791,8 @@ static noinline struct btrfs_device *device_list_add(const char *path,


if (!fs_devices) {
if (has_metadata_uuid)
fs_devices = alloc_fs_devices(disk_super->fsid,
disk_super->metadata_uuid);
else
fs_devices = alloc_fs_devices(disk_super->fsid, NULL);

fs_devices = alloc_fs_devices(disk_super->fsid,
has_metadata_uuid ? disk_super->metadata_uuid : NULL);
if (IS_ERR(fs_devices))
return ERR_CAST(fs_devices);

Expand Down

0 comments on commit c6930d7

Please sign in to comment.