Re: I'm a total push-over..
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 25, 2008, 06:50 UTC
- Message-ID
- <7vejc6761g.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <alpine.LFD.1.00.0801221913500.1741@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 14 quoted lines
> +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 <davem@davemloft.net> 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 <davem@davemloft.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>