On Fri, Oct 03, 2008 at 05:22:51PM -0700, Daniel Phillips wrote: > On Friday 03 October 2008 05:22, Chris Mason wrote: > > On Fri, 2008-10-03 at 14:42 +0300, Avi Kivity wrote: > > > I've been reading btrfs's on-disk format, and two things caught my eye > > > > > > - attribute((packed)) structures everywhere, often with misaligned > > > fields. This conserves space, but can be harmful to in-memory > > > performance on some archs. > > > > packed is important to make sure that a given field takes exactly the > > same amount of space everywhere, regardless of compiler optimization or > > arch. > > Amen. Are we sure that attribute ((packed)) works the same on all > arches? As long as you use types with strictly defined size, yes. > > And what about bitfields, does GCC pack them to the same size on all > arches in this case or take the easy way out as permitted by the > standard? I'm not sure, I believe a bit field on a strictly defined size will be packed the same everywhere. But bitfields + endian conversion are messy, so I avoid them. -chris -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
