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.

Reported-by: kernel test robot <[email protected]>
Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Thomas Bertschinger <[email protected]>
---
 fs/bcachefs/bcachefs_format.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
index 00060bc6128f..ada6f66f966a 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -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 */
-- 
2.43.0


Reply via email to