From: Jeff King <peff@peff.net>
To: Stefan Beller <sbeller@google.com>
Cc: gitster@pobox.com, git@vger.kernel.org
Subject: Re: [PATCH 1/2] packfile: close and free packs upon releasing an object store
Date: Thu, 10 May 2018 01:12:02 -0400 [thread overview]
Message-ID: <20180510051201.GB27259@sigill.intra.peff.net> (raw)
In-Reply-To: <20180510001211.163692-1-sbeller@google.com>
On Wed, May 09, 2018 at 05:12:10PM -0700, Stefan Beller wrote:
> In d0b59866223 (object-store: close all packs upon clearing the object
> store, 2018-03-23), we made sure to close all packfiles on releasing
> an object store, but we also have to free the memory of the closed packs.
I know we've assumed in a few places that a "struct packed_git" will
never go away. The one that comes to mind is the mru list.
It looks like we'll be OK here:
> diff --git a/object.c b/object.c
> index 66cffaf6e51..3e64a4a26dd 100644
> --- a/object.c
> +++ b/object.c
> @@ -485,6 +485,6 @@ void raw_object_store_clear(struct raw_object_store *o)
> o->alt_odb_tail = NULL;
>
> INIT_LIST_HEAD(&o->packed_git_mru);
> - close_all_packs(o);
> + close_and_free_packs(o);
> o->packed_git = NULL;
> }
because we clear the list above. But it would be dangerous for anybody
else to call close_and_free_packs(). Should that INIT_LIST_HEAD get
moved down into that function?
Probably the same applies to setting NULL here; you're left with a
dangling pointer if you just call close_and_free_packs(). Should
that helper maybe just be a static function in object.c?
Just brainstorming other places where the immutability of "struct
packed_git" might be important:
- pack-objects keeps a pointer from each object_entry to its
containing packed_git. That's probably OK, as you wouldn't expect to
be able to close the object store in the middle of that operation.
- the reachability bitmap code holds a pointer to the pack that has a
bitmap. Probably that whole "struct bitmap_index" needs to be part
of the object_store (arguably it should all just be _inside_ the
packed_git, but the current implementation avoids complexity by just
having a single bitmap-per-repo).
-Peff
prev parent reply other threads:[~2018-05-10 5:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 0:12 [PATCH 1/2] packfile: close and free packs upon releasing an object store Stefan Beller
2018-05-10 0:12 ` [PATCH 2/2] packfile.h: remove all extern keywords Stefan Beller
2018-05-10 5:12 ` Jeff King [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180510051201.GB27259@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sbeller@google.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).