diff mbox series

[1/2] btrfs: convert: Make read_disk_extent() return more meaningful -EIO other -1

Message ID 20180914072505.15916-2-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series Enhanced error messages for btrfs-convert | expand

Commit Message

Qu Wenruo Sept. 14, 2018, 7:25 a.m. UTC
When pread64() returns value smaller than expected, it normally means
EIO, so just return -EIO to replace the intermediate number.
So when IO fails, we should be able to get more meaningful error number
of than EPERM.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 convert/source-fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nikolay Borisov Sept. 14, 2018, 7:30 a.m. UTC | #1
On 14.09.2018 10:25, Qu Wenruo wrote:
> When pread64() returns value smaller than expected, it normally means
> EIO, so just return -EIO to replace the intermediate number.
> So when IO fails, we should be able to get more meaningful error number
> of than EPERM.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  convert/source-fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/convert/source-fs.c b/convert/source-fs.c
> index b6d08370428a..5660a22cc652 100644
> --- a/convert/source-fs.c
> +++ b/convert/source-fs.c
> @@ -201,7 +201,7 @@ int read_disk_extent(struct btrfs_root *root, u64 bytenr,
>  	ret = 0;
>  fail:
>  	if (ret > 0)
> -		ret = -1;
> +		ret = -EIO;
>  	return ret;
>  }
>  
>
diff mbox series

Patch

diff --git a/convert/source-fs.c b/convert/source-fs.c
index b6d08370428a..5660a22cc652 100644
--- a/convert/source-fs.c
+++ b/convert/source-fs.c
@@ -201,7 +201,7 @@  int read_disk_extent(struct btrfs_root *root, u64 bytenr,
 	ret = 0;
 fail:
 	if (ret > 0)
-		ret = -1;
+		ret = -EIO;
 	return ret;
 }