]> git.ipfire.org Git - thirdparty/git.git/commit - cache.h
Refactor how we open pack files to prepare for multiple windows.
authorShawn O. Pearce <spearce@spearce.org>
Sat, 23 Dec 2006 07:34:01 +0000 (02:34 -0500)
committerJunio C Hamano <junkio@cox.net>
Fri, 29 Dec 2006 19:36:44 +0000 (11:36 -0800)
commit9bc879c1ced505089e2a1e420d32599bb15b35b5
tree8fb8afafeac20359343f2acd2d142199a2de2546
parent75025ccdb79b5d6b290c630f8777c9f7bb9d257c
Refactor how we open pack files to prepare for multiple windows.

To efficiently support mmaping of multiple regions of the same pack
file we want to keep the pack's file descriptor open while we are
actively working with that pack.  So we are now keeping that file
descriptor in packed_git.pack_fd and closing it only after we unmap
the last window.

This is going to increase the number of file descriptors that are
in use at once, however that will be bounded by the total number of
pack files present and therefore should not be very high.  It is
a small tradeoff which we may need to revisit after some testing
can be done on various repositories and systems.

For code clarity we also want to seperate out the implementation
of how we open a pack file from the implementation which locates
a suitable window (or makes a new one) from the given pack file.
Since this is a rather large delta I'm taking advantage of doing
it now, in a fairly isolated change.

When we open a pack file we need to examine the header and trailer
without having a mmap in place, as we may only need to mmap
the middle section of this particular pack.  Consequently the
verification code has been refactored to make use of the new
read_or_die function.

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