Re: [PATCH 01/10] btrfs-progs: handle error if btrfs_write_one_block_group() failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2019/12/5 下午12:29, damenly.su@xxxxxxxxx wrote:
> From: Su Yue <Damenly_Su@xxxxxxx>
> 
> Just break loop and return the error code if failed.
> Functions in the call chain are able to handle it.
> 
> Signed-off-by: Su Yue <Damenly_Su@xxxxxxx>

Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>

> ---
>  extent-tree.c | 4 +++-
>  transaction.c | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/extent-tree.c b/extent-tree.c
> index 53be4f4c7369..4a3db029e811 100644
> --- a/extent-tree.c
> +++ b/extent-tree.c
> @@ -1596,9 +1596,11 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans)
>  
>  		cache = (struct btrfs_block_group_cache *)(unsigned long)ptr;
>  		ret = write_one_cache_group(trans, path, cache);
> +		if (ret)
> +			break;
>  	}
>  	btrfs_free_path(path);
> -	return 0;
> +	return ret;
>  }
>  
>  static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info,
> diff --git a/transaction.c b/transaction.c
> index 45bb9e1f9de6..c9035c765a74 100644
> --- a/transaction.c
> +++ b/transaction.c
> @@ -77,7 +77,9 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
>  					&root->root_item);
>  		if (ret < 0)
>  			return ret;
> -		btrfs_write_dirty_block_groups(trans);
> +		ret = btrfs_write_dirty_block_groups(trans);
> +		if (ret)
> +			return ret;
>  	}

Another hint for later cleanup.

What about killing that while (1) loop in another patch as a cleanup?

Thanks,
Qu


>  	return 0;
>  }
> 

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux