diff --git a/ebtree/ebtree.h b/ebtree/ebtree.h index 2e6ba03c0..0ba42f1ba 100644 --- a/ebtree/ebtree.h +++ b/ebtree/ebtree.h @@ -370,6 +370,8 @@ struct eb_root { * and one for the node, which remains unused in the very first node inserted * into the tree. This structure is 20 bytes per node on 32-bit machines. Do * not change the order, benchmarks have shown that it's optimal this way. + * Note: be careful about this struct's alignment if it gets included into + * another struct and some atomic ops are expected on the keys or the node. */ struct eb_node { struct eb_root branches; /* branches, must be at the beginning */ @@ -377,7 +379,10 @@ struct eb_node { eb_troot_t *leaf_p; /* leaf node's parent */ short int bit; /* link's bit position. */ short unsigned int pfx; /* data prefix length, always related to leaf */ -} __attribute__((packed)); +} +#ifdef HA_UNALIGNED + __attribute__((packed)); +#endif /* Return the structure of type whose member points to */ #define eb_entry(ptr, type, member) container_of(ptr, type, member)