From: Jonathan Tan <jonathantanmy@google.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, sbeller@google.com
Subject: Re: [PATCH 1/2] pack-bitmap: remove bitmap_git global variable
Date: Mon, 11 Jun 2018 11:50:46 -0700 [thread overview]
Message-ID: <20180611115046.d03f8093347dc6c0e9b116fc@google.com> (raw)
In-Reply-To: <20180609060437.GA30224@sigill.intra.peff.net>
On Sat, 9 Jun 2018 02:04:38 -0400
Jeff King <peff@peff.net> wrote:
> This function used to be idempotent, so any code which wanted to use the
> global bitmap_git could call it "just in case". After your patch, it's
> not. I think it's probably OK, since such functions would generally now
> take a bitmap_git argument and use that (e.g., rebuild_existing_bitmaps
> works that way after your patch).
Yes, and I've checked that the existing callers do not use bitmaps
twice. I've appended an extra paragraph for the commit message to this
e-mail below that will hopefully clarify things.
> We probably need to free(bitmap_git) before returning NULL here (this is
> still in prepare_bitmap_git()).
[snip]
> Ditto here (and probably other error returns lower in the function, but
> I didn't go through it carefully).
The contents of the struct also need to be handled, and I wanted to
handle it all at once in the subsequent patch. But you're right that the
commit message should explain that.
Here's an paragraph to be added to the end of the commit message. I can
send a reroll with the exact same code but with the updated commit
message if Junio requests it.
[additional paragraph begin]
This patch raises two potential issues: (1) memory for the struct
bitmap_index is allocated without being freed, and (2)
prepare_bitmap_git() and prepare_bitmap_walk() can reuse a previously
loaded bitmap. For (1), this will be dealt with in a subsequent patch in
this patch set that also deals with freeing the contents of the struct
bitmap_index (which were not freed previously, because they have global
scope). For (2), current bitmap users only load the bitmap once at most
(note that pack-objects can use bitmaps or write bitmaps, but not both
at the same time), so support for reuse has no effect - and future users
can pass around the struct bitmap_index * obtained if they need to do 2
or more things with the same bitmap.
[additional paragraph end]
next prev parent reply other threads:[~2018-06-11 18:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 19:04 [PATCH 0/2] Object store refactoring: make bitmap_git not global Jonathan Tan
2018-06-07 19:04 ` [PATCH 1/2] pack-bitmap: remove bitmap_git global variable Jonathan Tan
2018-06-09 6:04 ` Jeff King
2018-06-11 18:50 ` Jonathan Tan [this message]
2018-06-11 21:10 ` Jeff King
2018-06-07 19:04 ` [PATCH 2/2] pack-bitmap: add free function Jonathan Tan
2018-06-09 6:06 ` Jeff King
2018-06-12 0:00 ` [PATCH 0/2] Object store refactoring: make bitmap_git not global Stefan Beller
2018-06-25 18:22 ` Brandon Williams
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=20180611115046.d03f8093347dc6c0e9b116fc@google.com \
--to=jonathantanmy@google.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--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).