diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-09-03 21:35:44 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-09-17 13:38:46 -0700 |
commit | 82372bc816d75722c24d1abadb11cd8c0a33883a (patch) | |
tree | 25b4d0d6425c2a2d11fc557813599227064fa32f /fs/btrfs/volumes.c | |
parent | 67a2c45ee7f4f250458279a2e1244679c5d9735c (diff) | |
download | linux-82372bc816d75722c24d1abadb11cd8c0a33883a.tar.bz2 |
Btrfs: make the logic of source device removing more clear
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a15c8ac5d5b3..2e078fa705a6 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -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_alloc_list); fs_devices->num_devices--; - if (srcdev->missing) { + if (srcdev->missing) fs_devices->missing_devices--; - if (!fs_devices->seeding) - fs_devices->rw_devices++; + + if (srcdev->writeable) { + fs_devices->rw_devices--; + /* zero out the old super if it is writable */ + btrfs_scratch_superblock(srcdev); } - if (srcdev->bdev) { + if (srcdev->bdev) fs_devices->open_devices--; - /* - * zero out the old super if it is not writable - * (e.g. seed device) - */ - if (srcdev->writeable) - btrfs_scratch_superblock(srcdev); - } - call_rcu(&srcdev->rcu, free_device); /* |