]> git.ipfire.org Git - thirdparty/git.git/commit - sha1_file.c
Support unmapping windows on 'temporary' packfiles.
authorShawn O. Pearce <spearce@spearce.org>
Sat, 23 Dec 2006 07:34:44 +0000 (02:34 -0500)
committerJunio C Hamano <junkio@cox.net>
Fri, 29 Dec 2006 19:36:45 +0000 (11:36 -0800)
commit11daf39b74321d02d574479def29939d67c319ad
tree068c18a9a2947cfa341d473ce9871d85d58970a8
parent73b4e4be7128f75346ce6053d6da1672f243bc74
Support unmapping windows on 'temporary' packfiles.

If a command opens a packfile for only temporary access and does not
install the struct packed_git* into the global packed_git list then
we are unable to unmap any inactive windows within that packed_git,
causing the overall process to exceed core.packedGitLimit.

We cannot force the callers to install their temporary packfile
into the packed_git chain as doing so would allow that (possibly
corrupt but currently being verified) temporary packfile to become
part of the local ODB, which may allow it to be considered for
object resolution when it may not actually be a valid packfile.

So to support unmapping the windows of these temporary packfiles we
also scan the windows of the struct packed_git which was supplied
to use_pack().  Since commands only work with one temporary packfile
at a time scanning the one supplied to use_pack() and all packs
installed into packed_git should cover everything available in
memory.

We also have to be careful to not close the file descriptor of
the packed_git which was handed to use_pack() when all of that
packfile's windows have been unmapped, as we are already past the
open call that would open the packfile and need the file descriptor
to be ready for mmap() after unuse_one_window returns.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c