On Mon, Apr 17, 2017 at 06:16:25PM -0700, Liu Bo wrote:
> In the nocsum case of dio read endio, it will return immediately if an
> error got returned when repairing, which left the rest blocks unrepaired.
> The behavior is different from how buffered read endio works in the same
> case.  This changes it to record error only and go on repairing the rest
> blocks.
> 
> Signed-off-by: Liu Bo <bo.li....@oracle.com>

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

> ---
>  fs/btrfs/inode.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index fca2f1f..cc46d21 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -7942,6 +7942,7 @@ static int __btrfs_correct_data_nocsum(struct inode 
> *inode,
>       u32 sectorsize;
>       int nr_sectors;
>       int ret;
> +     int err;
>  
>       fs_info = BTRFS_I(inode)->root->fs_info;
>       sectorsize = fs_info->sectorsize;
> @@ -7962,8 +7963,10 @@ static int __btrfs_correct_data_nocsum(struct inode 
> *inode,
>                               pgoff, start, start + sectorsize - 1,
>                               io_bio->mirror_num,
>                               btrfs_retry_endio_nocsum, &done);
> -             if (ret)
> -                     return ret;
> +             if (ret) {
> +                     err = ret;
> +                     goto next;
> +             }
>  
>               wait_for_completion(&done.done);
>  
> @@ -7972,6 +7975,7 @@ static int __btrfs_correct_data_nocsum(struct inode 
> *inode,
>                       goto next_block_or_try_again;
>               }
>  
> +next:
>               start += sectorsize;
>  
>               if (nr_sectors--) {
> @@ -7980,7 +7984,7 @@ static int __btrfs_correct_data_nocsum(struct inode 
> *inode,
>               }
>       }
>  
> -     return 0;
> +     return err;
>  }
>  
>  static void btrfs_retry_endio(struct bio *bio)
> -- 
> 2.5.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to