mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-28 17:12:17 +00:00
c23e068aaf
[BUG] There is a bug report that btrfs-convert cannot handle unwritten extents (EXT2_EXTENT_FLAGS_UNINIT set, which is pretty much the same as BTRFS_FILE_EXTENT_PREALLOC), which can cause the converted image to have incorrect contents. [CAUSE] Currently we use ext2fs_block_iterate2() to go through all data extents of an ext2 inode, but it doesn't provide the info on if the range is unwritten or not. Thus for unwritten extents, the results btrfs would just treat it as regular extents, and read the contents from disk other than setting the contents to zero. [FIX] Instead of the ext2fs_block_iterate2(), here we follow the debugfs' "dump_extents" command, to use ext2fs_extent_*() helpers to go through every data extent of the inode, that's if the inode supports the EXT4_EXTENTS_FL flag. Now we can properly get the info of which extents are unwritten, and use holes to replace those unwritten extents. Reported-by: Yordan <y16267966@gmail.com> Link: https://lore.kernel.org/all/d34c7d77a7f00c93bea6a4d6e83c7caf.mailbg@mail.bg/ Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> |
||
---|---|---|
.. | ||
common.c | ||
common.h | ||
main.c | ||
Makefile | ||
source-ext2.c | ||
source-ext2.h | ||
source-fs.c | ||
source-fs.h | ||
source-reiserfs.c | ||
source-reiserfs.h |