Skip to contentSkip to conversation

bcachefs: fix warning about alignment of bversion in bkey

PATCH New Thomas Bertschinger 1 participant 1 message Feb 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: fix warning about alignment of bversion in bkey

This resolves a warning seen on big endian architectures where struct bversion is misaligned when embedded within struct bkey, because bversion has an explicit "__aligned(4)" attribute.

Because bversion's alignment in bkey is correct as-is, remove the explicit alignment attribute when compiling for big endian.

---
 fs/bcachefs/bcachefs_format.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/bcachefs/bcachefs_format.h +5 -1
index 00060bc6128f..ada6f66f966a 100644
@@ -189,7 +189,11 @@ struct bversion {
 	__u32		hi;
 	__u64		lo;
 #endif
-} __packed __aligned(4);
+} __packed
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+__aligned(4)
+#endif
+;
 
 struct bkey {
 	/* Size of combined key and value, in u64s */
Signature · 1 line
2.43.0