diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2016-03-16 19:05:11 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2016-03-16 21:36:25 +0100 |
commit | 87c181970dbe629befa98aafeee75b2641dacf63 (patch) | |
tree | aae18c85980ebbe346a30048e6c0bacfe61a3381 /src/indexer.c | |
parent | 77394a27af283b366fa8bb444d29670131bfa104 (diff) | |
download | libgit2-cmn/pool-limit.tar.gz |
Split the page size from the mmap alignmentcmn/pool-limit
While often similar, these are not the same on Windows. We want to use the page
size on Windows for the pools, but for mmap we need to use the allocation
granularity as the alignment.
On the other platforms these values remain the same.
Diffstat (limited to 'src/indexer.c')
-rw-r--r-- | src/indexer.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/indexer.c b/src/indexer.c index 9aa092556..1ffbc2790 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -449,7 +449,7 @@ static void hash_partially(git_indexer *idx, const uint8_t *data, size_t size) static int write_at(git_indexer *idx, const void *data, git_off_t offset, size_t size) { git_file fd = idx->pack->mwf.fd; - size_t page_size; + size_t mmap_alignment; size_t page_offset; git_off_t page_start; unsigned char *map_data; @@ -458,11 +458,11 @@ static int write_at(git_indexer *idx, const void *data, git_off_t offset, size_t assert(data && size); - if ((error = git__page_size(&page_size)) < 0) + if ((error = git__mmap_alignment(&mmap_alignment)) < 0) return error; - /* the offset needs to be at the beginning of the a page boundary */ - page_offset = offset % page_size; + /* the offset needs to be at the mmap boundary for the platform */ + page_offset = offset % mmap_alignment; page_start = offset - page_offset; if ((error = p_mmap(&map, page_offset + size, GIT_PROT_WRITE, GIT_MAP_SHARED, fd, page_start)) < 0) |