Open cmurf opened 2 years ago
Doesn't happen with an 8T image. It might be a problem related to the size of the target file system or block device.
It looks like the free space is correct. It's the total space that's wrong.
This seems to fix the incorrect total space (and block count) issue.
diff --git a/convert/source-ext2.c b/convert/source-ext2.c
index 9fad4c50..01b630ba 100644
--- a/convert/source-ext2.c
+++ b/convert/source-ext2.c
@@ -92,8 +92,8 @@ static int ext2_open_fs(struct btrfs_convert_context *cctx, const char *name)
cctx->fs_data = ext2_fs;
cctx->blocksize = ext2_fs->blocksize;
- cctx->block_count = ext2_fs->super->s_blocks_count;
- cctx->total_bytes = (u64)ext2_fs->super->s_blocks_count * ext2_fs->blocksize;
+ cctx->block_count = ext2fs_blocks_count(ext2_fs->super);
+ cctx->total_bytes = cctx->block_count * ext2_fs->blocksize;
cctx->label = strndup((char *)ext2_fs->super->s_volume_name, 16);
cctx->first_data_block = ext2_fs->super->s_first_data_block;
cctx->inodes_count = ext2_fs->super->s_inodes_count;
I'm still waiting for the conversion to finish to see if this also fixes the downstream bug. It's been running for 9 hours so far. It might be nice to add some sort of progress for the Create ext2 image file stage.
btrfs-progs-5.18-1.fc36.x86_64 kernel-5.19.0-0.rc4.20220628git941e3e791269.34.fc37.x86_64
btrfs-convert is reporting wildly incorrect free space in its output, over 200% is free (?) is impossible.
Reproduce steps:
Downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=2101045