path: root/convert
diff options
authorJeff Mahoney <>2018-04-30 10:37:06 -0400
committerDavid Sterba <>2018-06-07 16:37:35 +0200
commit36da47b409535f947549dcf560a3b1c1bd38af4a (patch)
tree9aea81e6006d1852f47b421ef7fd907f75ac6cbc /convert
parent4aebb2588c3f3164eba5833ffaf4eb101a05abb2 (diff)
btrfs-progs: convert: fix support for e2fsprogs < 1.42
Commit 324d4c1857a (btrfs-progs: convert: Add larger device support) introduced new dependencies on the 64-bit API provided by e2fsprogs. That API was introduced in v1.42 (along with bigalloc). This patch maps the following to their equivalents in e2fsprogs < 1.42. - ext2fs_get_block_bitmap_range2 - ext2fs_inode_data_blocks2 - ext2fs_read_ext_attr2 Since we need to detect and define EXT2_FLAG_64BITS for compatibilty anyway, it makes sense to use that to detect the older e2fsprogs instead of defining a new flag ourselves. Signed-off-by: Jeff Mahoney <> Signed-off-by: David Sterba <>
Diffstat (limited to 'convert')
1 files changed, 11 insertions, 1 deletions
diff --git a/convert/source-ext2.h b/convert/source-ext2.h
index 80833b21..c3214125 100644
--- a/convert/source-ext2.h
+++ b/convert/source-ext2.h
@@ -33,8 +33,18 @@
* Unlike normal RO compat flag, BIGALLOC affects how e2fsprogs check used
* space, and btrfs-convert heavily relies on it.
+ *
+ * e2fsprogs 1.42 also introduced the 64-bit API. Any file system
+ * that requires it will have EXT4_FEATURE_INCOMPAT_64BIT set and
+ * will fail to open with earlier releases. We can map it to the
+ * older API without risk of corruption.
+#ifndef EXT2_FLAG_64BITS
+#define EXT2_FLAG_64BITS (0)
+#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_CLUSTER_RATIO(fs) (1)
#define EXT2FS_B2C(fs, blk) (blk)