btrfs: cleanup assigning next active device with a check
Creates helper fucntion as needed by the device delete and replace operations. Also now it checks if the next device being assigned is an active device. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
@@ -569,11 +569,9 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
|
||||
ASSERT(list_empty(&src_device->resized_list));
|
||||
tgt_device->commit_total_bytes = src_device->commit_total_bytes;
|
||||
tgt_device->commit_bytes_used = src_device->bytes_used;
|
||||
if (fs_info->sb->s_bdev &&
|
||||
(fs_info->sb->s_bdev == src_device->bdev))
|
||||
fs_info->sb->s_bdev = tgt_device->bdev;
|
||||
if (fs_info->fs_devices->latest_bdev == src_device->bdev)
|
||||
fs_info->fs_devices->latest_bdev = tgt_device->bdev;
|
||||
|
||||
btrfs_assign_next_active_device(fs_info, src_device, tgt_device);
|
||||
|
||||
list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list);
|
||||
fs_info->fs_devices->rw_devices++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user