[btrfs-progs] btrfs-convert, ext2_copy_inodes: print inode number on error
diff mbox series

Message ID 1593363342-19104-1-git-send-email-asmadeus@codewreck.org
State New
Headers show
  • [btrfs-progs] btrfs-convert, ext2_copy_inodes: print inode number on error
Related show

Commit Message

Dominique Martinet June 28, 2020, 4:55 p.m. UTC
if ext2_copy_inodes fails on ext2_copy_single_inode on a specific inode,
there is no message whatsoever to help identify what caused the problem.

Printing the inode number at least makes it possible to look it up
(debugfs, stat <inode_num> or ncheck <inode_num>) and investigate what
went wrong
Had an error on btrfs-convert and was a bit clueless what happened
when the only error was the following:
ERROR: error during copy_inodes -95210]
WARNING: an error occurred during conversion, filesystem is partially created but not finalized and not mountable
It turns out the '210]' part of the line is leftover from the progress
indicator (I was wondering what the hell is that errno?!), and it always
happened on the same inode so I just had to delete it to get
btrfs-convert to succeed.

Turns out that was an old ext4 cryptfs test laying around that I have no
need for... Now I know that it'll be easy to make a reproducer smaller
than 300GB so also possible to figure an even better error message (or
interactively offer to skip?) but for now at least this simple message
will help a lot!


 convert/source-ext2.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/convert/source-ext2.c b/convert/source-ext2.c
index f248249f..ba65c9f9 100644
--- a/convert/source-ext2.c
+++ b/convert/source-ext2.c
@@ -827,8 +827,11 @@  static int ext2_copy_inodes(struct btrfs_convert_context *cctx,
-		if (ret)
+		if (ret) {
+			fprintf(stderr, "ext2_copy_single_inode failed on ino %u: %d\n",
+				ext2_ino, ret);
 			return ret;
+		}
 		 * blocks_used is the number of new tree blocks allocated in
 		 * current transaction.