On Fri, Sep 07, 2018 at 02:16:23PM +0800, Qu Wenruo wrote:
> Function btrfs_trim_fs() doesn't handle errors in a consistent way, if
> error happens when trimming existing block groups, it will skip the
> remaining blocks and continue to trim unallocated space for each device.
> 
> And the return value will only reflect the final error from device
> trimming.
> 
> This patch will fix such behavior by:
> 
> 1) Recording last error from block group or device trimming
>    So return value will also reflect the last error during trimming.
>    Make developer more aware of the problem.
> 
> 2) Continuing trimming if we can
>    If we failed to trim one block group or device, we could still try
>    next block group or device.
> 
> 3) Report number of failures during block group and device trimming
>    So it would be less noisy, but still gives user a brief summary of
>    what's going wrong.
> 
> Such behavior can avoid confusion for case like failure to trim the
> first block group and then only unallocated space is trimmed.
> 
> Reported-by: Chris Murphy <li...@colorremedies.com>
> Signed-off-by: Qu Wenruo <w...@suse.com>

Reviewed-by: David Sterba <dste...@suse.com>

> -                     ret = btrfs_trim_block_group(cache,
> -                                                  &group_trimmed,
> -                                                  start,
> -                                                  end,
> -                                                  range->minlen);
> +                     ret = btrfs_trim_block_group(cache, &group_trimmed,
> +                                             start, end, range->minlen);

No unrealted changes please, this just reformats the argument list.

Reply via email to