Refactor packed_git to prepare for sliding mmap windows.

The idea behind the sliding mmap window pack reader implementation
is to have multiple mmap regions active against the same pack file,
thereby allowing the process to mmap in only the active/hot sections
of the pack and reduce overall virtual address space usage.

To implement this we need to refactor the mmap related data
(pack_base, pack_use_cnt) out of struct packed_git and move them
into a new struct pack_window.

We are refactoring the code to support a single struct pack_window
per packfile, thereby emulating the prior behavior of mmap'ing the
entire pack file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Shawn O. Pearce
2006-12-23 02:33:44 -05:00
committed by Junio C Hamano
parent 77ccc5bbd1
commit c41ee586dc
4 changed files with 40 additions and 34 deletions

View File

@ -438,7 +438,7 @@ static unsigned long write_object(struct sha1file *f,
}
use_packed_git(p);
buf = (char *) p->pack_base
buf = p->windows->base
+ entry->in_pack_offset
+ entry->in_pack_header_size;
datalen = find_packed_object_size(p, entry->in_pack_offset)
@ -943,7 +943,7 @@ static void check_object(struct object_entry *entry)
struct object_entry *base_entry = NULL;
use_packed_git(p);
buf = p->pack_base;
buf = p->windows->base;
buf += entry->in_pack_offset;
/* We want in_pack_type even if we do not reuse delta.