On 7.11.18 г. 13:43 ч., Anand Jain wrote:
> At the time of forced unmount we place the running replace to
> BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state, so when the system comes
> back and suppose the target device is missing, then let the replace
> state continue to be in BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state
> instead of BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED as there isn't any
> matching scrub running as part of replace.
>
> Signed-off-by: Anand Jain <anand.j...@oracle.com>
> ---
> fs/btrfs/dev-replace.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
> index 59991165e126..47d6768a9cde 100644
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -884,6 +884,9 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info
> *fs_info)
> "cannot continue dev_replace, tgtdev is missing");
> btrfs_info(fs_info,
> "you may cancel the operation after 'mount -o
> degraded'");
> + dev_replace->replace_state =
> + BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED;
> + dev_replace->item_needs_writeback = 1;
Why do we need items_needs_writeback = 1 here, nothing is changed w.r.t
on-disk data?
> btrfs_dev_replace_write_unlock(dev_replace);
> return 0;
> }
>