summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-03-20 15:37:08 +0100
committerDavid Sterba <dsterba@suse.com>2018-05-28 18:07:23 +0200
commit6fc4749d25738e1a5e5b02d04a0a60bbae516652 (patch)
tree4f740bceb00bc2e9a28a52ff2840b7bef21610b2 /fs/btrfs/volumes.c
parentbtrfs: squeeze btrfs_dev_replace_continue_on_mount to its caller (diff)
downloadlinux-6fc4749d25738e1a5e5b02d04a0a60bbae516652.tar.xz
linux-6fc4749d25738e1a5e5b02d04a0a60bbae516652.zip
btrfs: make success path out of btrfs_init_dev_replace_tgtdev more clear
This is a preparatory cleanup that will make clear that the only successful way out of btrfs_init_dev_replace_tgtdev will also set the device_out to a valid pointer. With this guarantee, the callers can be simplified. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 70a87d4fe5fe..a8f8a2e39da6 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2612,6 +2612,12 @@ error:
return ret;
}
+/*
+ * Initialize a new device for device replace target from a given source dev
+ * and path.
+ *
+ * Return 0 and new device in @device_out, otherwise return < 0
+ */
int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
const char *device_path,
struct btrfs_device *srcdev,
@@ -2698,7 +2704,7 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
*device_out = device;
- return ret;
+ return 0;
error:
blkdev_put(bdev, FMODE_EXCL);