Web lists-archives.com

Re: [PATCH/RFC v3 07/12] pack-objects: move in_pack out of struct object_entry

Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> Instead of using 8 bytes (on 64 bit arch) to store a pointer to a
> pack. Use an index isntead since the number of packs should be
> relatively small.
> This limits the number of packs we can handle to 16k. For now if you hit
> 16k pack files limit, pack-objects will simply fail [1].
> This technically saves 7 bytes. But we don't see any of that in
> practice due to padding. The saving becomes real when we pack this
> struct tighter later.

Somehow 7 and 16k do not add up.

We use 8 bytes in the original code, and a solution that potentially
saves 7 bytes would use only 1 byte instead of the original 8, which
would allow us to index/identify 1<<8 == 256 packs, but for some reason
we can handle up to 16k.

> [1] The escape hatch is .keep file to limit the non-kept pack files
>     below 16k limit. Then you can go for another pack-objects run to
>     combine another 16k pack files. Repeat until you're satisfied.


> +static inline unsigned int oe_add_pack(struct packing_data *pack,
> +				       struct packed_git *p)
> +{
> +	if (pack->in_pack_count >= (1 << OE_IN_PACK_BITS))
> +		die(_("too many packs to handle in one go. "
> +		      "Please add .keep files to exclude\n"
> +		      "some pack files and keep the number "
> +		      "of non-kept files below %d."),
> +		    1 << OE_IN_PACK_BITS);