From 4ab083175ac88bf8ee70e4cf48f7eaf6c7a391f8 Mon Sep 17 00:00:00 2001 From: Anand Jain Date: Tue, 27 Jun 2023 16:53:13 +0800 Subject: [PATCH] btrfs-progs: dump-super: improve error message on failed read Add more error information to help debugging: $ ./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 Reviewed-by: Qu Wenruo Signed-off-by: Anand Jain Signed-off-by: David Sterba --- 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 d62c3a85..51845b0a 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; }