From: Jeff King <peff@peff.net>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, "Jan Pokorný" <poki@fnusa.cz>
Subject: Re: [PATCH 2/4] repack: populate extension bits incrementally
Date: Fri, 21 Oct 2022 19:42:25 -0400 [thread overview]
Message-ID: <Y1MuYQSo7rb6WCE8@coredump.intra.peff.net> (raw)
In-Reply-To: <Y1MsdAgL8fdIRtxH@coredump.intra.peff.net>
On Fri, Oct 21, 2022 at 07:34:13PM -0400, Jeff King wrote:
> On Fri, Oct 21, 2022 at 07:20:48PM -0400, Taylor Blau wrote:
>
> > On Fri, Oct 21, 2022 at 05:43:46PM -0400, Jeff King wrote:
> > > There are two small problems with this:
> > >
> > > - repack_promisor_objects() may have added entries to "names", and
> > > already called populate_pack_exts() for them. This is mostly just
> > > wasteful, as we'll stat() the filename with each possible extension,
> > > get the same result, and just overwrite our bits. But it makes the
> > > code flow confusing, and it will become a problem if we try to make
> > > populate_pack_exts() do more things.
> >
> > Hmm. I agree with you that repack_promisor_objects() calling
> > populate_pack_exts() itself is at best weird, and at worst wasteful.
>
> I don't think it's weird, really. It is setting up the entries in the
> string-list completely when we add them, rather than annotating later.
> If there were some performance gain from doing them all at once, I could
> see it, but otherwise I like that it means the entries are always in a
> consistent state.
I think my original didn't explain my thinking very well. And its "two
small problems" is really a bit of a lie. It is really one small
problem, and a tweak I want in order to make a future patch work. :)
So here's what I wrote instead:
-- >8 --
There's one small problem with this. In repack_promisor_objects(), we
may add entries to "names" and call populate_pack_exts() for them.
Calling it again is mostly just wasteful, as we'll stat() the filename
with each possible extension, get the same result, and just overwrite
our bits.
So we could drop the call there, and leave the final loop to populate
all of the bits. But instead, this patch does the reverse: drops the
final loop, and teaches the other two sites to populate the bits as they
add entries.
This makes the code easier to reason about, as you never have to worry
about when the util field is valid; it is always valid for each entry.
It also serves my ulterior purpose: recording the generated filenames as
soon as possible will make it easier for a future patch to use them for
cleaning up from a failed operation.
-- >8 --
-Peff
next prev parent reply other threads:[~2022-10-21 23:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 21:41 [PATCH 0/4] repack tempfile-cleanup signal deadlock Jeff King
2022-10-21 21:42 ` [PATCH 1/4] repack: convert "names" util bitfield to array Jeff King
2022-10-21 22:19 ` Junio C Hamano
2022-10-21 23:10 ` Taylor Blau
2022-10-21 23:29 ` Jeff King
2022-10-21 23:35 ` Junio C Hamano
2022-10-21 23:43 ` Jeff King
2022-10-21 23:51 ` Junio C Hamano
2022-10-22 0:12 ` Jeff King
2022-10-21 21:43 ` [PATCH 2/4] repack: populate extension bits incrementally Jeff King
2022-10-21 23:20 ` Taylor Blau
2022-10-21 23:34 ` Jeff King
2022-10-21 23:41 ` Taylor Blau
2022-10-21 23:42 ` Jeff King [this message]
2022-10-21 21:46 ` [PATCH 3/4] repack: use tempfiles for signal cleanup Jeff King
2022-10-21 22:30 ` Junio C Hamano
2022-10-21 23:24 ` Jeff King
2022-10-21 23:45 ` Taylor Blau
2022-10-22 0:12 ` Jeff King
2022-10-22 0:11 ` Jeff King
2022-10-21 21:48 ` [PATCH 4/4] repack: drop remove_temporary_files() Jeff King
2022-10-21 23:51 ` Taylor Blau
2022-10-22 0:21 ` [PATCH v2 0/5] repack tempfile-cleanup signal deadlock Jeff King
2022-10-22 0:21 ` [PATCH v2 1/5] repack: convert "names" util bitfield to array Jeff King
2022-10-22 0:21 ` [PATCH v2 2/5] repack: populate extension bits incrementally Jeff King
2022-10-22 0:21 ` [PATCH v2 3/5] repack: expand error message for missing pack files Jeff King
2022-10-22 0:21 ` [PATCH v2 4/5] repack: use tempfiles for signal cleanup Jeff King
2022-10-22 20:35 ` Jeff King
2022-10-23 0:14 ` Junio C Hamano
2022-10-23 17:00 ` Jeff King
2022-10-23 18:08 ` Junio C Hamano
2022-10-23 20:55 ` Jeff King
2022-10-23 21:48 ` Junio C Hamano
2022-10-22 0:21 ` [PATCH v2 5/5] repack: drop remove_temporary_files() Jeff King
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=Y1MuYQSo7rb6WCE8@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=poki@fnusa.cz \
/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 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 NNTP newsgroup(s).