History

btrfs: dev replace should replace the sysfs entry

when we replace the device its corresponding sysfs entry has to be replaced as well

Anand Jain committed 12 years ago

Commit 49c6f731 parent 0d393761 file · +5 −0Browse files

Unified · Split

fs/btrfs/dev-replace.c+5−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include "check-integrity.h"
3737 #include "rcu-string.h"
3838 #include "dev-replace.h"
39+#include "sysfs.h"
3940
4041 static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
4142 int scrub_ret);
@@ -562,6 +563,10 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, · 520 unmodified lines
562563 fs_info->fs_devices->latest_bdev = tgt_device->bdev;
563564 list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list);
564565
566+ /* replace the sysfs entry */
567+ btrfs_kobj_rm_device(fs_info, src_device);
568+ btrfs_kobj_add_device(fs_info, tgt_device);
569+
565570 btrfs_rm_dev_replace_blocked(fs_info);
566571
567572 btrfs_rm_dev_replace_srcdev(fs_info, src_device);