Re: [PATCH 10/44] object-store: move packed_git and packed_git_mru to object store
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Mar 19, 2018, 19:39 UTC
- Message-ID
- <20180319123914.6767c0660fb3e77247f02989@google.com>
- In-Reply-To
- <20180303113637.26518-11-pclouds@gmail.com>
On Sat, 3 Mar 2018 18:36:03 +0700 Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 10 quoted lines
> From: Stefan Beller <sbeller@google.com> > > In a process with multiple repositories open, packfile accessors > should be associated to a single repository and not shared globally. > Move packed_git and packed_git_mru into the_repository and adjust > callers to reflect this. > > [nd: while at there, wrap access to these two fields in get_packed_git() > and get_packed_git_mru(). This allows us to lazily initialize these > fields without caller doing that explicitly]
The patches up to this one look good. (I didn't reply for each individual one to avoid unnecessarily sending messages to the list.)
About this patch: will lazily initializing these fields be done in a later patch?
Show 13 quoted lines
> Patch generated by > > 1. Moving the struct packed_git declaration to object-store.h > and packed_git, packed_git_mru globals to struct object_store. > > 2. Apply the following semantic patch to adjust callers: > @@ @@ > - packed_git > + the_repository->objects.packed_git > > @@ @@ > - packed_git_mru > + the_repository->objects.packed_git_mru
This doesn't seem up-to-date - they are being replaced with a function call, not a field access. I would be OK with just removing this "Patch generated by" section.
[snip remainder of "Patch generated by" section]
Show 9 quoted lines
> @@ -246,7 +244,7 @@ static int unuse_one_window(struct packed_git *current)
>
> if (current)
> scan_windows(current, &lru_p, &lru_w, &lru_l);
> - for (p = packed_git; p; p = p->next)
> + for (p = the_repository->objects.packed_git; p; p = p->next)
> scan_windows(p, &lru_p, &lru_w, &lru_l);
> if (lru_p) {
> munmap(lru_w->base, lru_w->len);Here (and elsewhere), "the_repository->objects.packed_git" instead of "get_packed_git" is still used.