On Thu, Jul 19, 2018 at 05:16:42PM +0200, Duy Nguyen wrote:
> On Thu, Jul 19, 2018 at 07:57:37AM +0200, Duy Nguyen wrote:
> > I thought 2M was generous but I was obviously wrong. I'd like to see
> > the biggest delta size in this pack and whether it's still reasonable
> > to increase OE_DELTA_SIZE_BITS. But if it's very close to 4GB limit
> > then we could just store 64-bit delta size in a separate array.
>
> I realize now that these two options don't have to be mutually
> exclusive and I should provide a good fallback in terms of performance
> anyway.
Yeah, this is what I had assumed was happening in the original code. :)
> +void oe_prepare_delta_size_array(struct packing_data *pack)
> +{
> + int i;
> +
> + /*
> + * nr_alloc, not nr_objects to align with realloc() strategy in
> + * packlist_alloc()
> + */
> + ALLOC_ARRAY(pack->delta_size, pack->nr_alloc);
> +
> + for (i = 0; i < pack->nr_objects; i++)
> + pack->delta_size[i] = pack->objects[i].delta_size_;
> +}
This iterator should probably be a uint32_t, to match nr_objects.
The rest of the patch looks OK to me. From Elijah's failure report there
clearly is _some_ problem where we end up with a truncated write of a
delta. But I don't see it from code inspection, nor could I reproduce
it.
-Peff