Skip to contentSkip to conversation

libbcachefs: convert sb features mask to little endian

PATCH Applied Brian Foster 2 participants 2 messages Sep 15, 2023 – Sep 19, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbcachefs: convert sb features mask to little endian

bch_sb.features is an array of __le64. Convert the native endian format of the features mask appropriately. This causes a bcachefs format to produce an unmountable fs when run from a big endian system.

---
 libbcachefs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libbcachefs.c +1 -1
index bac772b..44a5fbf 100644
@@ -193,7 +193,7 @@ struct bch_sb *bch2_format(struct bch_opt_strs	fs_opt_strs,
 	sb.sb->nr_devices	= nr_devs;
 
 	if (opts.version == bcachefs_metadata_version_current)
-		sb.sb->features[0] |= BCH_SB_FEATURES_ALL;
+		sb.sb->features[0] |= cpu_to_le64(BCH_SB_FEATURES_ALL);
 
 	uuid_generate(sb.sb->uuid.b);
 
Signature · 1 line
2.41.0
#1 lore raw
Quoted 5 lines · Brian Foster

bch_sb.features is an array of __le64. Convert the native endian format of the features mask appropriately. This causes a bcachefs format to produce an unmountable fs when run from a big endian system.

Thanks, applied