On 2018/10/23 下午5:41, Su Yue wrote:
> If found a extent data item has unaligned part, lowmem repair
> just deletes it.
Fair enough solution.
Much better than the unpredictable original mode solution.
>
> Signed-off-by: Su Yue <suy.fnst@xxxxxxxxxxxxxx>
Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>
Thanks,
Qu
> ---
> check/mode-lowmem.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
> index 3c9ecff7e498..5381096fa8b2 100644
> --- a/check/mode-lowmem.c
> +++ b/check/mode-lowmem.c
> @@ -2972,6 +2972,7 @@ out:
> }
>
> /*
> + * If @err contains BYTES_UNALIGNED then delete the extent data item.
> * If @err contains BACKREF_MISSING then add extent of the
> * file_extent_data_item.
> *
> @@ -3023,6 +3024,13 @@ static int repair_extent_data_item(struct btrfs_root *root,
> else
> parent = 0;
>
> + if (err & BYTES_UNALIGNED) {
> + ret = delete_item(root, pathp);
> + if (!ret)
> + err = 0;
> + goto out;
> + }
> +
> /* now repair only adds backref */
> if ((err & BACKREF_MISSING) == 0)
> return err;
>