From c41ee586dc95b757cdff4deae10a30a691ba758b Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 23 Dec 2006 02:33:44 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- pack-check.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pack-check.c') diff --git a/pack-check.c b/pack-check.c index 491bad2ae4..761cc852e9 100644 --- a/pack-check.c +++ b/pack-check.c @@ -13,7 +13,8 @@ static int verify_packfile(struct packed_git *p) int nr_objects, err, i; /* Header consistency check */ - hdr = p->pack_base; + pack_base = p->windows->base; + hdr = (struct pack_header*)pack_base; if (hdr->hdr_signature != htonl(PACK_SIGNATURE)) return error("Packfile %s signature mismatch", p->pack_name); if (!pack_version_ok(hdr->hdr_version)) @@ -26,7 +27,6 @@ static int verify_packfile(struct packed_git *p) num_packed_objects(p)); SHA1_Init(&ctx); - pack_base = p->pack_base; SHA1_Update(&ctx, pack_base, pack_size - 20); SHA1_Final(sha1, &ctx); if (hashcmp(sha1, (unsigned char *)pack_base + pack_size - 20)) @@ -78,7 +78,7 @@ static void show_pack_info(struct packed_git *p) int nr_objects, i; unsigned int chain_histogram[MAX_CHAIN]; - hdr = p->pack_base; + hdr = (struct pack_header*)p->windows->base; nr_objects = ntohl(hdr->hdr_entries); memset(chain_histogram, 0, sizeof(chain_histogram)); -- cgit v1.2.3