Re: [PATCH 05/16] odb: move MRU list of packfiles into `struct packfile_store`
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Aug 20, 2025, 12:44 UTC
- Message-ID
- <CAOLa=ZRfWamERa_tKenhnxaGnH096p8hGYjauzfw1UzzjA_T_g@mail.gmail.com>
- In-Reply-To
- <20250819-b4-pks-packfiles-store-v1-5-1660842e125a@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 7 quoted lines
> The object database tracks the list of packfiles in most-recently-used > order, which is mostly used to favor reading from packfiles that contain > most of the objects that we're currently accessing. With the > introduction of the `struct packfile_store` we have a better place to > host this list though. > > Move the list accordingly.
[snip]
Show 17 quoted lines
> diff --git a/packfile.h b/packfile.h
> index 2f84d7d7e6..3022f3a19e 100644
> --- a/packfile.h
> +++ b/packfile.h
> @@ -65,6 +65,9 @@ struct packfile_store {
> */
> struct packed_git *packs;
>
> + /* A most-recently-used ordered version of the packs list. */
> + struct list_head mru;
> +
> /*
> * A map of packfile names to packed_git structs for tracking which
> * packs have been loaded already.
>
> --
> 2.51.0.261.g7ce5a0a67e.dirtyQuestion: for my understanding, so we maintain a list of `packed_git` packfiles in `packfile_store.packs` and then the same list is available in a MRU form in `packfile_store.mru`?
I assume this is to optimize searches to use the mru form? Is there a reason to not pick the mru list?
Thanks