diff options
Diffstat (limited to 'fs/btrfs/dev-replace.c')
| -rw-r--r-- | fs/btrfs/dev-replace.c | 16 | 
1 files changed, 7 insertions, 9 deletions
| diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index fbb8b4457a72..c85a7d44da79 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -70,6 +70,7 @@ static int btrfs_dev_replace_kthread(void *data);  int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)  { +	struct btrfs_dev_lookup_args args = { .devid = BTRFS_DEV_REPLACE_DEVID };  	struct btrfs_key key;  	struct btrfs_root *dev_root = fs_info->dev_root;  	struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace; @@ -100,8 +101,7 @@ no_valid_dev_replace_entry_found:  		 * We don't have a replace item or it's corrupted.  If there is  		 * a replace target, fail the mount.  		 */ -		if (btrfs_find_device(fs_info->fs_devices, -				      BTRFS_DEV_REPLACE_DEVID, NULL, NULL)) { +		if (btrfs_find_device(fs_info->fs_devices, &args)) {  			btrfs_err(fs_info,  			"found replace target device without a valid replace item");  			ret = -EUCLEAN; @@ -163,8 +163,7 @@ no_valid_dev_replace_entry_found:  		 * We don't have an active replace item but if there is a  		 * replace target, fail the mount.  		 */ -		if (btrfs_find_device(fs_info->fs_devices, -				      BTRFS_DEV_REPLACE_DEVID, NULL, NULL)) { +		if (btrfs_find_device(fs_info->fs_devices, &args)) {  			btrfs_err(fs_info,  			"replace devid present without an active replace item");  			ret = -EUCLEAN; @@ -175,11 +174,10 @@ no_valid_dev_replace_entry_found:  		break;  	case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED:  	case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED: -		dev_replace->srcdev = btrfs_find_device(fs_info->fs_devices, -						src_devid, NULL, NULL); -		dev_replace->tgtdev = btrfs_find_device(fs_info->fs_devices, -							BTRFS_DEV_REPLACE_DEVID, -							NULL, NULL); +		dev_replace->tgtdev = btrfs_find_device(fs_info->fs_devices, &args); +		args.devid = src_devid; +		dev_replace->srcdev = btrfs_find_device(fs_info->fs_devices, &args); +  		/*  		 * allow 'btrfs dev replace_cancel' if src/tgt device is  		 * missing |