diff options
author | Anand Jain <anand.jain@oracle.com> | 2016-05-03 05:44:43 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-05-04 04:41:08 -0400 |
commit | 88acff64c621aaeee2a4fe0ed124c77358069bce (patch) | |
tree | bcb38903c2ae7e890fcc752f2ff3cd6a162025c3 /fs/btrfs/dev-replace.c | |
parent | 8ed01abe7da6af62f2089da9a4c1fe839dc638f5 (diff) |
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>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r-- | fs/btrfs/dev-replace.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index c93eec9ca433..1f193f742f21 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
@@ -569,11 +569,9 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
569 | ASSERT(list_empty(&src_device->resized_list)); | 569 | ASSERT(list_empty(&src_device->resized_list)); |
570 | tgt_device->commit_total_bytes = src_device->commit_total_bytes; | 570 | tgt_device->commit_total_bytes = src_device->commit_total_bytes; |
571 | tgt_device->commit_bytes_used = src_device->bytes_used; | 571 | tgt_device->commit_bytes_used = src_device->bytes_used; |
572 | if (fs_info->sb->s_bdev && | 572 | |
573 | (fs_info->sb->s_bdev == src_device->bdev)) | 573 | btrfs_assign_next_active_device(fs_info, src_device, tgt_device); |
574 | fs_info->sb->s_bdev = tgt_device->bdev; | 574 | |
575 | if (fs_info->fs_devices->latest_bdev == src_device->bdev) | ||
576 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; | ||
577 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); | 575 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); |
578 | fs_info->fs_devices->rw_devices++; | 576 | fs_info->fs_devices->rw_devices++; |
579 | 577 | ||