Commit 82372bc8 authored by Miao Xie's avatar Miao Xie Committed by Chris Mason

Btrfs: make the logic of source device removing more clear

Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 67a2c45e
...@@ -569,7 +569,6 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, ...@@ -569,7 +569,6 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
if (fs_info->fs_devices->latest_bdev == src_device->bdev) if (fs_info->fs_devices->latest_bdev == src_device->bdev)
fs_info->fs_devices->latest_bdev = tgt_device->bdev; fs_info->fs_devices->latest_bdev = tgt_device->bdev;
list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list);
if (src_device->fs_devices->seeding)
fs_info->fs_devices->rw_devices++; fs_info->fs_devices->rw_devices++;
/* replace the sysfs entry */ /* replace the sysfs entry */
......
...@@ -1819,23 +1819,18 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info, ...@@ -1819,23 +1819,18 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info,
list_del_rcu(&srcdev->dev_list); list_del_rcu(&srcdev->dev_list);
list_del_rcu(&srcdev->dev_alloc_list); list_del_rcu(&srcdev->dev_alloc_list);
fs_devices->num_devices--; fs_devices->num_devices--;
if (srcdev->missing) { if (srcdev->missing)
fs_devices->missing_devices--; fs_devices->missing_devices--;
if (!fs_devices->seeding)
fs_devices->rw_devices++;
}
if (srcdev->bdev) {
fs_devices->open_devices--;
/* if (srcdev->writeable) {
* zero out the old super if it is not writable fs_devices->rw_devices--;
* (e.g. seed device) /* zero out the old super if it is writable */
*/
if (srcdev->writeable)
btrfs_scratch_superblock(srcdev); btrfs_scratch_superblock(srcdev);
} }
if (srcdev->bdev)
fs_devices->open_devices--;
call_rcu(&srcdev->rcu, free_device); call_rcu(&srcdev->rcu, free_device);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment