Re: [PATCH v2 9/9] pack-objects: improve partial packfile reuse
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Oct 19, 2019, 19:20 UTC
- Message-ID
- <CAP8UFD2rsZj3=KoPCEWw2sTXFhNkynrJLeAGWK2vEbD5GU8chA@mail.gmail.com>
- In-Reply-To
- <6e4ad9bb-20d7-4ae5-8768-326f5c455c3c@iee.email>
Hi Philip,
On Sat, Oct 19, 2019 at 5:30 PM Philip Oakley <philipoakley@iee.email> wrote:
> On 19/10/2019 11:35, Christian Couder wrote:
Show 8 quoted lines
> > +static void write_reused_pack_one(size_t pos, struct hashfile *out,
> > + struct pack_window **w_curs)
> > +{
> > + off_t offset, next, cur;
> > + enum object_type type;
> > + unsigned long size;
>
> Is this a mem_sized size or a counter for less that 4GiB items?What I can see is that `&size` is passed as the last argument to unpack_object_header() below. And unpack_object_header() is defined in packfile.h like this:
int unpack_object_header(struct packed_git *, struct pack_window **, off_t *, unsigned long *);
since at least 336226c259 (packfile.h: drop extern from function declarations, 2019-04-05)
So fixing this, if it needs to be fixed, should probably be part of a separate topic fixing unpack_object_header().
Show 12 quoted lines
> > + > > + offset = reuse_packfile->revindex[pos].offset; > > + next = reuse_packfile->revindex[pos + 1].offset; > > > > - if (reuse_packfile_offset < 0) > > - reuse_packfile_offset = reuse_packfile->pack_size - the_hash_algo->rawsz; > > + record_reused_object(offset, offset - hashfile_total(out)); > > > > - total = to_write = reuse_packfile_offset - sizeof(struct pack_header); > > + cur = offset; > > + type = unpack_object_header(reuse_packfile, w_curs, &cur, &size); > > + assert(type >= 0);
Show 11 quoted lines
> > +static void try_partial_reuse(struct bitmap_index *bitmap_git,
> > + size_t pos,
> > + struct bitmap *reuse,
> > + struct pack_window **w_curs)
> > {
> > + struct revindex_entry *revidx;
> > + off_t offset;
> > + enum object_type type;
> > + unsigned long size;
>
> Is this mem_sized or a <4GiB size?Again this `size` variable is passed as the last argument to unpack_object_header() below.
...
> Apologies if these are dumb queries..
I think it's a valid concern, so it's certainly ok for you to ask these questions.