mdbx: rework mmap-functions for osal.

- add 'length' and 'current' fields to mmap-object;
 - drop mdbx_mremap();
 - do remap on-demand inside mdbx_mresize();
 - add mdbx_mapresize() which re-creates Valgrind's region.
 - call resize on txn-begin.

Change-Id: I82780f92c4947804e3f14fb7cb71ee655382f9bb
This commit is contained in:
Leo Yuriev
2017-07-12 21:13:17 +03:00
parent 700ec68d06
commit 17e8429a29
9 changed files with 290 additions and 244 deletions

View File

@@ -444,17 +444,19 @@ typedef struct mdbx_mmap_param {
struct MDBX_lockinfo *lck;
};
mdbx_filehandle_t fd;
size_t length; /* mapping length, but NOT a size of file or DB */
#if defined(_WIN32) || defined(_WIN64)
size_t current; /* mapped region size, e.g. file and DB */
#endif
#ifdef MDBX_OSAL_SECTION
MDBX_OSAL_SECTION section;
#endif
} mdbx_mmap_t;
int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t length, size_t limit);
int mdbx_munmap(mdbx_mmap_t *map, size_t length);
int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t must, size_t limit);
int mdbx_munmap(mdbx_mmap_t *map);
int mdbx_mlock(mdbx_mmap_t *map, size_t length);
int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t current, size_t wanna);
int mdbx_mremap(int flags, mdbx_mmap_t *map, size_t old_limit,
size_t new_limit);
int mdbx_msync(mdbx_mmap_t *map, size_t offset, size_t length, int async);
static __inline mdbx_pid_t mdbx_getpid(void) {