[PATCH v3 00/10] Start tracking packfiles per object database source
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 9, 2026, 08:33 UTC
- Message-ID
- <20260109-b4-pks-pack-store-via-source-v3-0-877fd7b7bf81@pks.im>
- In-Reply-To
- <20251215-b4-pks-pack-store-via-source-v1-0-433aac465295@pks.im>
Hi,
the `struct packfile_store` tracks packfiles we have in the repository so that we can look up objects stored therein. Right now, the packfile store is tracked on the object database level -- each object database has exactly one packfile store. Consequently, we track packfiles that are part of different object database sources via the same packfile store.
This patch series refactors this so that we instead have one packfile store per ODB source. This means that access to any object, regardless of whether it is stored in a packfile or in a loose object, is always done via its owning source.
This is the last step required for pluggable object databases: all object access is routed through sources, and we can thus now abstract these sources and then plug in a different implementation. Of course, these abstractions are still very leaky, and we still reach into the implementation details in a bunch of files. But this is something that will be addressed over subsequent steps.
This series is built on top of d8af7cadaa (The eighth batch, 2025-12-14) with the following two series merged into it:
- ps/object-read-stream at 7b94028652 (streaming: drop redundant type
and size pointers, 2025-11-23). - ps/odb-misc-fixes at 8915881686 (odb: properly close sources before
freeing them, 2025-12-11).The latter topic isn't in "next" yet, but the second version of this topic only contains two small memory leak fixes. I don't expect it to change, and I guess it should land soonish anyway.
Changes in v3: - Fix a commit message typo. - Link to v2: https://lore.kernel.org/r/20251218-b4-pks-pack-store-via-source-v2-0-62849007ce21@pks.im
Changes in v2: - Fix some stale comments that still refer to `kept_pack_cache()`. - Improve commit messages a bit. - Link to v1: https://lore.kernel.org/r/20251215-b4-pks-pack-store-via-source-v1-0-433aac465295@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (10):
packfile: create store via its owning source
packfile: pass source to `prepare_pack()`
packfile: refactor kept-pack cache to work with packfile stores
packfile: refactor misleading code when unusing pack windows
packfile: move packfile store into object source
packfile: only prepare owning store in `packfile_store_get_packs()`
packfile: only prepare owning store in `packfile_store_prepare()`
packfile: inline `find_kept_pack_entry()`
packfile: refactor `find_pack_entry()` to work on the packfile store
packfile: move MIDX into packfile storebuiltin/fast-import.c | 37 +++++--- builtin/grep.c | 10 ++- builtin/index-pack.c | 2 +- builtin/pack-objects.c | 104 +++++++++++----------- http.c | 2 +- midx.c | 19 ++-- odb.c | 44 ++++------ odb.h | 11 +-- odb/streaming.c | 9 +- packfile.c | 229 +++++++++++++++++++++++++++---------------------- packfile.h | 102 ++++++++++++++++------ reachable.c | 2 +- revision.c | 8 +- 13 files changed, 329 insertions(+), 250 deletions(-)
Range-diff versus v2:
1: be2e03d09a = 1: 3c4a729c4b packfile: create store via its owning source
2: 11902d6203 = 2: 7c34d0704f packfile: pass source to `prepare_pack()`
3: 4cc8fe64fa = 3: 34f6a6e84c packfile: refactor kept-pack cache to work with packfile stores
4: f6cfa54a3e = 4: ba6c3af972 packfile: refactor misleading code when unusing pack windows
5: 0f9d97d10c = 5: 0b83159e54 packfile: move packfile store into object source
6: 426fe55d38 = 6: 2de6b860cf packfile: only prepare owning store in `packfile_store_get_packs()`
7: 0f959db581 = 7: c020bd5bc8 packfile: only prepare owning store in `packfile_store_prepare()`
8: 0692b83a0c ! 8: 998a96bf05 packfile: inline `find_kept_pack_entry()`
@@ Commit message
packfile: inline `find_kept_pack_entry()`
The `find_kept_pack_entry()` function is only used in
- `has_oject_kept_pack()`, which is only a trivial wrapper itself. Inline
+ `has_object_kept_pack()`, which is only a trivial wrapper itself. Inline
the latter into the former.
Furthermore, reorder the code so that we can drop the declaration of the
9: e9dc4bc63d = 9: 320e88c3d7 packfile: refactor `find_pack_entry()` to work on the packfile store
10: eef3e7868e = 10: 62062a7696 packfile: move MIDX into packfile store--- base-commit: a531cef344bcbcdca16c33bd34fbf4ec0065ab5e change-id: 20251201-b4-pks-pack-store-via-source-fd43dc0765a7