@@ -288,8 +288,8 @@ error:
return -1;
}
-static int ext2_block_iterate_proc(ext2_filsys fs, blk_t *blocknr,
- e2_blkcnt_t blockcnt, blk_t ref_block,
+static int ext2_block_iterate_proc(ext2_filsys fs, blk64_t *blocknr,
+ e2_blkcnt_t blockcnt, blk64_t ref_block,
int ref_offset, void *priv_data)
{
int ret;
@@ -323,7 +323,7 @@ static int ext2_create_file_extents(struct btrfs_trans_handle *trans,
init_blk_iterate_data(&data, trans, root, btrfs_inode, objectid,
convert_flags & CONVERT_FLAG_DATACSUM);
- err = ext2fs_block_iterate2(ext2_fs, ext2_ino, BLOCK_FLAG_DATA_ONLY,
+ err = ext2fs_block_iterate3(ext2_fs, ext2_ino, BLOCK_FLAG_DATA_ONLY,
NULL, ext2_block_iterate_proc, &data);
if (err)
goto error;
@@ -46,7 +46,7 @@ struct btrfs_trans_handle;
#define ext2fs_get_block_bitmap_range2 ext2fs_get_block_bitmap_range
#define ext2fs_inode_data_blocks2 ext2fs_inode_data_blocks
#define ext2fs_read_ext_attr2 ext2fs_read_ext_attr
-#define ext2fs_blocks_count(s) ((s)->s_blocks_count)
+#define ext2fs_blocks_count(s) ((s)->s_blocks_count_hi << 32) | (s)->s_blocks_count
#define EXT2FS_CLUSTER_RATIO(fs) (1)
#define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_BLOCKS_PER_GROUP(s))
#define EXT2FS_B2C(fs, blk) (blk)
In ext4, number of blocks can be greater than 2^32. Therefore, if btrfs-convert is used on filesystems greater than 16TiB (Staring from 16TiB, number of blocks overflow 32 bits), it fails to convert. Fix it by considering 64 bit block numbers. Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com> --- convert/source-ext2.c | 6 +++--- convert/source-ext2.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)