Re: [PATCH v4 00/15] packfile: carve out a new packfile store
Patrick Steinhardt <ps@pks.im> writes:
Show 64 quoted lines
> Hi,
>
> information about a object database's packfiles is currently distributed
> across two different structures:
>
> - `struct packed_git` contains the `next` pointer as well as the
> `mru_head`, both of which serve to store the list of packfiles.
>
> - `struct object_database` contains several fields that relate to the
> packfiles.
>
> So we don't really have a central data structure that tracks our
> packfiles, and consequently responsibilities aren't always clear cut.
> A consequence for the upcoming pluggable object databases is that this
> makes it very hard to move management of packfiles from the object
> database level down into the object database source.
>
> This patch series introduces a new `struct packfile_store`, which is
> about to become the single source of truth for managing packfiles, and
> carves out the packfile store subsystem.
>
> This is the first step to make packfiles work with pluggable object
> databases. Next steps will be to:
>
> - Move the `struct packed_git::next` and `struct packed::mru_head`
> pointers into the packfile store so that `struct packed_git` only
> tracks a single packfile.
>
> - Push the `struct packfile_store` down one level so that it's not
> hosted by the object database anymore, but instead by the object
> database source.
>
> Changes in v2:
> - Convert the `initialized` flag into a boolean.
> - Polish some commit messages.
> - Some smaller formatting changes to the layout of `struct
> object_database`.
> - Link to v1: https://lore.kernel.org/r/20250819-b4-pks-packfiles-store-v1-0-1660842e125a@pks.im
>
> Changes in v3:
> - Rebased on top of master at 6ad8021821 (The fifth batch, 2025-08-29)
> with ps/object-store-midx-dedup-info at 13296ac909 (midx: compute
> paths via their source, 2025-08-11) merged into it. This fixes
> various conflicts with "seen". There's still two conflicts: a
> trivial one with jt/de-global-bulk-checkin. And a more complex one
> with tb/prepare-midx-pack-cleanup. I don't think it's necessary to
> really address the first one, but I'm unsure how to proceed with the
> second one given that the patch series still seems to be cooking.
> - Set `struct object_database::packfiles` to `NULL` after free'ing it.
> - Add a comment to explain the kept cache.
> - Fix a missing `obj_read_lock()` call.
> - Drop the commit that always adds packfiles to the MRU. I've moved
> this into a subsequent patch series.
> - Avoid some overly long lines by storing the pointer to the packfile
> store on the stack.
> - Point out the difference between `get_all_packs()` and
> `get_packed_git()`.
> - Link to v2: https://lore.kernel.org/r/20250821-b4-pks-packfiles-store-v2-0-d10623355e9f@pks.im
>
> Changes in v4:
> - Small code style improvement as suggested by Junio.
> - Some commit message improvements as suggested by Karthik.
> - Link to v3: https://lore.kernel.org/r/20250902-b4-pks-packfiles-store-v3-0-6925278efeda@pks.im
>
The range-diff looked good to me. Thanks,
Karthik
[snip]