All of lore.kernel.org
 help / color / mirror / Atom feed
From: Toon Claes <toon@iotcl.com>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Cc: Justin Tobler <jltobler@gmail.com>
Subject: Re: [PATCH v2 03/10] packfile: refactor kept-pack cache to work with packfile stores
Date: Tue, 06 Jan 2026 21:42:09 +0100	[thread overview]
Message-ID: <87jyxupj6m.fsf@iotcl.com> (raw)
In-Reply-To: <20251218-b4-pks-pack-store-via-source-v2-3-62849007ce21@pks.im>

Patrick Steinhardt <ps@pks.im> writes:

> The kept pack cache is a cache of packfiles that are marked as kept
> either via an accompanying ".kept" file or via an in-memory flag. The
> cache can be retrieved via `kept_pack_cache()`, where one needs to pass
> in a repository.
>
> Ultimately though the kept-pack cache is a property of the packfile
> store, and this causes problems in a subsequent commit where we want to
> move down the packfile store to be a per-object-source entity.
>
> Prepare for this and refactor the kept-pack cache to work on top of a
> packfile store instead. While at it, rename both the function and flags
> specific to the kept-pack cache so that they can be properly attributed
> to the respective subsystems.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  builtin/pack-objects.c | 12 ++++++------
>  packfile.c             | 37 ++++++++++++++++++++-----------------
>  packfile.h             | 25 +++++++++++++++++--------
>  reachable.c            |  2 +-
>  revision.c             |  8 ++++----
>  5 files changed, 48 insertions(+), 36 deletions(-)
>
> [snip]
>
> diff --git a/packfile.h b/packfile.h
> index 33cc1c1654..410f85f03d 100644
> --- a/packfile.h
> +++ b/packfile.h
> @@ -90,9 +90,10 @@ struct packfile_store {
>  	 * is an on-disk ".keep" file or because they are marked as "kept" in
>  	 * memory.
>  	 *
> -	 * Should not be accessed directly, but via `kept_pack_cache()`. The
> -	 * list of packs gets invalidated when the stored flags and the flags
> -	 * passed to `kept_pack_cache()` mismatch.
> +	 * Should not be accessed directly, but via
> +	 * `packfile_store_get_kept_pack_cache()`. The list of packs gets
> +	 * invalidated when the stored flags and the flags passed to
> +	 * `packfile_store_get_kept_pack_cache()` mismatch.
>  	 */
>  	struct {
>  		struct packed_git **packs;
> @@ -210,6 +211,19 @@ struct packed_git *packfile_store_load_pack(struct packfile_store *store,
>  int packfile_store_freshen_object(struct packfile_store *store,
>  				  const struct object_id *oid);
>  
> +enum kept_pack_type {
> +	KEPT_PACK_ON_DISK = (1 << 0),
> +	KEPT_PACK_IN_CORE = (1 << 1),
> +};

Thanks for making it more clear this is used as a bitfield. I also
appreciate the rename.

> +
> +/*
> + * Retrieve the cache of kept packs from the given packfile store. Accepts a
> + * combination of `kept_pack_type` flags. The cache is computed on demand and
> + * will be recomputed whenever the flags change.
> + */

Also this comments helps, thanks.

> +struct packed_git **packfile_store_get_kept_pack_cache(struct packfile_store *store,
> +						       unsigned flags);
> +
>  struct pack_window {
>  	struct pack_window *next;
>  	unsigned char *base;

-- 
Cheers,
Toon

  reply	other threads:[~2026-01-06 20:42 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15  7:36 [PATCH 00/10] Start tracking packfiles per object database source Patrick Steinhardt
2025-12-15  7:36 ` [PATCH 01/10] packfile: create store via its owning source Patrick Steinhardt
2025-12-15 21:30   ` Justin Tobler
2025-12-16  8:36     ` Patrick Steinhardt
2025-12-15  7:36 ` [PATCH 02/10] packfile: pass source to `prepare_pack()` Patrick Steinhardt
2025-12-15 21:38   ` Justin Tobler
2025-12-15  7:36 ` [PATCH 03/10] packfile: refactor kept-pack cache to work with packfile stores Patrick Steinhardt
2025-12-15 21:56   ` Justin Tobler
2025-12-16  9:09     ` Patrick Steinhardt
2025-12-15  7:36 ` [PATCH 04/10] packfile: refactor misleading code when unusing pack windows Patrick Steinhardt
2025-12-15  7:36 ` [PATCH 05/10] packfile: move packfile store into object source Patrick Steinhardt
2025-12-18  0:52   ` Justin Tobler
2025-12-18  6:50     ` Patrick Steinhardt
2025-12-15  7:36 ` [PATCH 06/10] packfile: only prepare owning store in `packfile_store_get_packs()` Patrick Steinhardt
2025-12-18  0:58   ` Justin Tobler
2025-12-15  7:36 ` [PATCH 07/10] packfile: only prepare owning store in `packfile_store_prepare()` Patrick Steinhardt
2025-12-15  7:36 ` [PATCH 08/10] packfile: inline `find_kept_pack_entry()` Patrick Steinhardt
2025-12-18  1:06   ` Justin Tobler
2025-12-18  6:48     ` Patrick Steinhardt
2025-12-15  7:36 ` [PATCH 09/10] packfile: refactor `find_pack_entry()` to work on the packfile store Patrick Steinhardt
2025-12-15  7:36 ` [PATCH 10/10] packfile: move MIDX into " Patrick Steinhardt
2025-12-18  6:55 ` [PATCH v2 00/10] Start tracking packfiles per object database source Patrick Steinhardt
2025-12-18  6:55   ` [PATCH v2 01/10] packfile: create store via its owning source Patrick Steinhardt
2025-12-18  6:55   ` [PATCH v2 02/10] packfile: pass source to `prepare_pack()` Patrick Steinhardt
2025-12-18  6:55   ` [PATCH v2 03/10] packfile: refactor kept-pack cache to work with packfile stores Patrick Steinhardt
2026-01-06 20:42     ` Toon Claes [this message]
2025-12-18  6:55   ` [PATCH v2 04/10] packfile: refactor misleading code when unusing pack windows Patrick Steinhardt
2026-01-07 10:13     ` Toon Claes
2025-12-18  6:55   ` [PATCH v2 05/10] packfile: move packfile store into object source Patrick Steinhardt
2026-01-07 13:11     ` Toon Claes
2025-12-18  6:55   ` [PATCH v2 06/10] packfile: only prepare owning store in `packfile_store_get_packs()` Patrick Steinhardt
2025-12-18  6:55   ` [PATCH v2 07/10] packfile: only prepare owning store in `packfile_store_prepare()` Patrick Steinhardt
2026-01-07 13:15     ` Toon Claes
2025-12-18  6:55   ` [PATCH v2 08/10] packfile: inline `find_kept_pack_entry()` Patrick Steinhardt
2026-01-08  7:16     ` Kristoffer Haugsbakk
2026-01-09  6:17       ` Patrick Steinhardt
2025-12-18  6:55   ` [PATCH v2 09/10] packfile: refactor `find_pack_entry()` to work on the packfile store Patrick Steinhardt
2025-12-18  6:55   ` [PATCH v2 10/10] packfile: move MIDX into " Patrick Steinhardt
2026-01-09  8:33 ` [PATCH v3 00/10] Start tracking packfiles per object database source Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 01/10] packfile: create store via its owning source Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 02/10] packfile: pass source to `prepare_pack()` Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 03/10] packfile: refactor kept-pack cache to work with packfile stores Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 04/10] packfile: refactor misleading code when unusing pack windows Patrick Steinhardt
2026-01-12 14:52     ` Karthik Nayak
2026-01-09  8:33   ` [PATCH v3 05/10] packfile: move packfile store into object source Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 06/10] packfile: only prepare owning store in `packfile_store_get_packs()` Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 07/10] packfile: only prepare owning store in `packfile_store_prepare()` Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 08/10] packfile: inline `find_kept_pack_entry()` Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 09/10] packfile: refactor `find_pack_entry()` to work on the packfile store Patrick Steinhardt
2026-01-09  8:33   ` [PATCH v3 10/10] packfile: move MIDX into " Patrick Steinhardt
2026-01-11  5:46   ` [PATCH v3 00/10] Start tracking packfiles per object database source Junio C Hamano
2026-01-12 15:27   ` Justin Tobler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jyxupj6m.fsf@iotcl.com \
    --to=toon@iotcl.com \
    --cc=git@vger.kernel.org \
    --cc=jltobler@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.