summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2015-03-10 06:38:42 +0800
committerDavid Sterba <dsterba@suse.cz>2015-06-19 14:03:54 +0200
commitd2ff1b2008cb807102fc9496fadd8eddff98350c (patch)
tree30f177410dff822ca0801747c2375f603e630178 /fs/btrfs/dev-replace.c
parent4fde46f0cc71c7aba299ee6dfb4f017fb97b6e70 (diff)
downloadlinux-d2ff1b2008cb807102fc9496fadd8eddff98350c.tar.bz2
Btrfs: sysfs: add support to show replacing target in the sysfs
This patch will add support to show the replacing target in sysfs during the process of replacement. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r--fs/btrfs/dev-replace.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index f982ef303f1c..862fbc206755 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -376,6 +376,10 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
WARN_ON(!tgt_device);
dev_replace->tgtdev = tgt_device;
+ ret = btrfs_kobj_add_device(tgt_device->fs_devices, tgt_device);
+ if (ret)
+ btrfs_error(root->fs_info, ret, "kobj add dev failed");
+
printk_in_rcu(KERN_INFO
"BTRFS: dev_replace from %s (devid %llu) to %s started\n",
src_device->missing ? "<missing disk>" :
@@ -584,7 +588,6 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
/* replace the sysfs entry */
btrfs_kobj_rm_device(fs_info->fs_devices, src_device);
- btrfs_kobj_add_device(fs_info->fs_devices, tgt_device);
btrfs_rm_dev_replace_free_srcdev(fs_info, src_device);
/* write back the superblocks */