From: Junio C Hamano Date: Fri, 25 Jan 2008 06:50:19 GMT Subject: Re: I'm a total push-over.. Message-ID: <7vejc6761g.fsf@gitster.siamese.dyndns.org> In-Reply-To: Linus Torvalds writes: > +static inline size_t estimate_cache_size(size_t ondisk_size, unsigned int entries) > +{ > + long per_entry; > + > + per_entry = sizeof(struct cache_entry) - sizeof(struct ondisk_cache_entry); > + > + /* > + * Alignment can cause differences. This should be "alignof", but > + * since that's a gcc'ism, just use the size of a pointer. > + */ > + per_entry += sizeof(void *); > + return ondisk_size + entries*per_entry; > +} > + I wonder if the issue Dave Miller addressed with 69ae517541ed5ab7d4fdcd8f82a9b8bd949df347 (fast-import: fix unalinged allocation and access) applies here. commit 69ae517541ed5ab7d4fdcd8f82a9b8bd949df347 Author: David S. Miller Date: Fri Dec 14 20:39:16 2007 -0800 fast-import: fix unalinged allocation and access The specialized pool allocator fast-import uses aligned objects on the size of a pointer, which was not sufficient at least on Sparc. Instead, make the alignment for objects of type unitmax_t. Signed-off-by: David S. Miller Signed-off-by: Junio C Hamano