Skip to content

Commit c0d81c7

Browse files
Su Yuekdave
authored andcommitted
btrfs: Call find_fsid from find_fsid_inprogress
Since find_fsid_inprogress should also handle the case in which an fs didn't change its FSID make it call find_fsid directly. This makes the code in device_list_add simpler by eliminating a conditional call of find_fsid. No functional changes. Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Su Yue <[email protected]> Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b5e4ff9 commit c0d81c7

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

fs/btrfs/volumes.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,9 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,
672672

673673
/*
674674
* Handle scanned device having its CHANGING_FSID_V2 flag set and the fs_devices
675-
* being created with a disk that has already completed its fsid change.
675+
* being created with a disk that has already completed its fsid change. Such
676+
* disk can belong to an fs which has its FSID changed or to one which doesn't.
677+
* Handle both cases here.
676678
*/
677679
static struct btrfs_fs_devices *find_fsid_inprogress(
678680
struct btrfs_super_block *disk_super)
@@ -688,7 +690,7 @@ static struct btrfs_fs_devices *find_fsid_inprogress(
688690
}
689691
}
690692

691-
return NULL;
693+
return find_fsid(disk_super->fsid, NULL);
692694
}
693695

694696

@@ -737,19 +739,10 @@ static noinline struct btrfs_device *device_list_add(const char *path,
737739
BTRFS_SUPER_FLAG_CHANGING_FSID_V2);
738740

739741
if (fsid_change_in_progress) {
740-
if (!has_metadata_uuid) {
741-
/*
742-
* When we have an image which has CHANGING_FSID_V2 set
743-
* it might belong to either a filesystem which has
744-
* disks with completed fsid change or it might belong
745-
* to fs with no UUID changes in effect, handle both.
746-
*/
742+
if (!has_metadata_uuid)
747743
fs_devices = find_fsid_inprogress(disk_super);
748-
if (!fs_devices)
749-
fs_devices = find_fsid(disk_super->fsid, NULL);
750-
} else {
744+
else
751745
fs_devices = find_fsid_changed(disk_super);
752-
}
753746
} else if (has_metadata_uuid) {
754747
fs_devices = find_fsid(disk_super->fsid,
755748
disk_super->metadata_uuid);

0 commit comments

Comments
 (0)