From d131b7afea58f47721dafd013ab6aff4adfc42dd Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 2 Mar 2011 10:01:54 -0800 Subject: sha1_file.c: Don't retain open fds on small packs If a pack file is small enough that its entire contents fits within one mmap window, mmap the file and then immediately close its file descriptor. This reduces the number of file descriptors that are needed to read from repositories with many tiny pack files, such as one that has received 1000 pushes (and created 1000 small pack files) since its last repack. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- fast-import.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fast-import.c') diff --git a/fast-import.c b/fast-import.c index 970d8470e..2369a7b30 100644 --- a/fast-import.c +++ b/fast-import.c @@ -871,6 +871,7 @@ static void start_packfile(void) p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2); strcpy(p->pack_name, tmpfile); p->pack_fd = pack_fd; + p->do_not_close = 1; pack_file = sha1fd(pack_fd, p->pack_name); hdr.hdr_signature = htonl(PACK_SIGNATURE); -- cgit v1.2.1