diff mbox series

[1/3] btrfs-progs: dump-super: improve error log

Message ID d9fb113f645e6c882041aea91a356ec3a36c2240.1687854248.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: dump-super: fix dump-super on aarch64 | expand

Commit Message

Anand Jain June 27, 2023, 8:53 a.m. UTC
Add more error info to help debug.

  $ ./btrfs inspect-internal dump-super -Ffa /dev/vdb10

  Before:
  ERROR: failed to read the superblock on /dev/vdb10 at 274877906944

  After:
  ERROR: failed to read the superblock on /dev/vdb10 at 274877906944
  read 0/4096 bytes

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds/inspect-dump-super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Qu Wenruo June 27, 2023, 9:16 a.m. UTC | #1
On 2023/6/27 16:53, Anand Jain wrote:
> Add more error info to help debug.
>
>    $ ./btrfs inspect-internal dump-super -Ffa /dev/vdb10
>
>    Before:
>    ERROR: failed to read the superblock on /dev/vdb10 at 274877906944
>
>    After:
>    ERROR: failed to read the superblock on /dev/vdb10 at 274877906944
>    read 0/4096 bytes
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   cmds/inspect-dump-super.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/cmds/inspect-dump-super.c b/cmds/inspect-dump-super.c
> index d62c3a85d9ca..4529b2308d7e 100644
> --- a/cmds/inspect-dump-super.c
> +++ b/cmds/inspect-dump-super.c
> @@ -41,7 +41,8 @@ static int load_and_dump_sb(char *filename, int fd, u64 sb_bytenr, int full,
>   		if (ret == 0 && errno == 0)
>   			return 0;
>
> -		error("failed to read the superblock on %s at %llu", filename, sb_bytenr);
> +		error("Failed to read the superblock on %s at %llu read %llu/%d bytes",
> +		       filename, sb_bytenr, ret, BTRFS_SUPER_INFO_SIZE);
>   		error("error = '%m', errno = %d", errno);
>   		return 1;
>   	}
diff mbox series

Patch

diff --git a/cmds/inspect-dump-super.c b/cmds/inspect-dump-super.c
index d62c3a85d9ca..4529b2308d7e 100644
--- a/cmds/inspect-dump-super.c
+++ b/cmds/inspect-dump-super.c
@@ -41,7 +41,8 @@  static int load_and_dump_sb(char *filename, int fd, u64 sb_bytenr, int full,
 		if (ret == 0 && errno == 0)
 			return 0;
 
-		error("failed to read the superblock on %s at %llu", filename, sb_bytenr);
+		error("Failed to read the superblock on %s at %llu read %llu/%d bytes",
+		       filename, sb_bytenr, ret, BTRFS_SUPER_INFO_SIZE);
 		error("error = '%m', errno = %d", errno);
 		return 1;
 	}