On 27.11.18 г. 4:33 ч., Qu Wenruo wrote:
> This patch will remove all existing dev extents for later rebuild.
> 
> Signed-off-by: Qu Wenruo <[email protected]>
> ---
>  image/main.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
> 
> diff --git a/image/main.c b/image/main.c
> index 9060f6b1b665..707568f22e01 100644
> --- a/image/main.c
> +++ b/image/main.c
> @@ -2210,6 +2210,70 @@ static void fixup_block_groups(struct 
> btrfs_trans_handle *trans,
>       }
>  }
>  
> +static int remove_all_dev_extents(struct btrfs_trans_handle *trans,
> +                               struct btrfs_fs_info *fs_info)

remove fs_info arg.

<snip>
> +
> +static int fixup_dev_extents(struct btrfs_trans_handle *trans,
> +                          struct btrfs_fs_info *fs_info)

Ditto

> +{
> +     int ret;
> +
> +     ret = remove_all_dev_extents(trans, fs_info);
> +     if (ret < 0)
> +             error("failed to remove all existing dev extents: %s",
> +                     strerror(-ret));
> +     return ret;
> +}
> +
>  static int fixup_chunks_and_devices(struct btrfs_fs_info *fs_info,
>                        struct mdrestore_struct *mdres, off_t dev_size)
>  {
> @@ -2227,6 +2291,10 @@ static int fixup_chunks_and_devices(struct 
> btrfs_fs_info *fs_info,
>       }
>  
>       fixup_block_groups(trans, fs_info);
> +     ret = fixup_dev_extents(trans, fs_info);
> +     if (ret < 0)
> +             goto error;
> +
>       ret = fixup_device_size(trans, fs_info, mdres, dev_size);
>       if (ret < 0)
>               goto error;
> 

Reply via email to