From 9e473ab6f2dcf5d86e8eb74cbe1fe5b47d892e29 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Wed, 26 Jul 2017 11:48:34 +0300 Subject: [PATCH] mdbx: remove obsolete mlock(). Change-Id: I23df282d545eac9dd7bf9df1bd71dedbccc45cfd --- src/mdbx.c | 8 -------- src/osal.c | 8 -------- src/osal.h | 3 +-- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/mdbx.c b/src/mdbx.c index 6399fc7a..dde2f598 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -4219,14 +4219,6 @@ static int __cold mdbx_env_map(MDBX_env *env, size_t usedsize) { return errno; #endif - /* Lock meta pages to avoid unexpected write, - * before the data pages would be synchronized. */ - if (env->me_flags & MDBX_WRITEMAP) { - rc = mdbx_mlock(&env->me_dxb_mmap, pgno2bytes(env, NUM_METAS)); - if (unlikely(rc != MDBX_SUCCESS)) - return rc; - } - #ifdef USE_VALGRIND env->me_valgrind_handle = VALGRIND_CREATE_BLOCK(env->me_map, env->me_mapsize, "mdbx"); diff --git a/src/osal.c b/src/osal.c index 71e67868..8595dec7 100644 --- a/src/osal.c +++ b/src/osal.c @@ -930,14 +930,6 @@ int mdbx_munmap(mdbx_mmap_t *map) { return MDBX_SUCCESS; } -int mdbx_mlock(mdbx_mmap_t *map, size_t length) { -#if defined(_WIN32) || defined(_WIN64) - return VirtualLock(map->address, length) ? MDBX_SUCCESS : GetLastError(); -#else - return (mlock(map->address, length) == 0) ? MDBX_SUCCESS : errno; -#endif -} - int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t must, size_t limit) { assert(must <= limit); #if defined(_WIN32) || defined(_WIN64) diff --git a/src/osal.h b/src/osal.h index c6cad301..92527f60 100644 --- a/src/osal.h +++ b/src/osal.h @@ -1,4 +1,4 @@ -/* https://en.wikipedia.org/wiki/Operating_system_abstraction_layer */ +/* https://en.wikipedia.org/wiki/Operating_system_abstraction_layer */ /* * Copyright 2015-2017 Leonid Yuriev @@ -455,7 +455,6 @@ typedef struct mdbx_mmap_param { 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_msync(mdbx_mmap_t *map, size_t offset, size_t length, int async);