From 822952ef017e34bc8e8be69f819abc08768c0f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Fri, 2 Dec 2022 19:50:31 +0300 Subject: [PATCH] =?UTF-8?q?mdbx:=20=D0=B2=D0=BD=D1=83=D1=82=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D0=B5=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20`MDBX=5FSYNC?= =?UTF-8?q?=5FKICK`=20(=D0=BA=D0=BE=D1=81=D0=BC=D0=B5=D1=82=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core.c | 12 ++++++------ src/osal.c | 4 ++-- src/osal.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core.c b/src/core.c index 7b1b3d17..e5953d96 100644 --- a/src/core.c +++ b/src/core.c @@ -1681,7 +1681,7 @@ __cold static int uniq_check(const osal_mmap_t *pending, MDBX_env **found) { err = uniq_poke(pending, &scan->me_lck_mmap, &salt); if (err == MDBX_RESULT_TRUE) { (void)osal_msync(&scan->me_lck_mmap, 0, sizeof(MDBX_lockinfo), - MDBX_SYNC_NONE); + MDBX_SYNC_KICK); err = uniq_poke(pending, &scan->me_lck_mmap, &salt); } if (err == MDBX_RESULT_TRUE) { @@ -4813,7 +4813,7 @@ __cold static int txn_spill_slowpath(MDBX_txn *const txn, MDBX_cursor *const m0, const MDBX_env *env = txn->mt_env; rc = osal_msync(&txn->mt_env->me_dxb_mmap, 0, - pgno_align2os_bytes(env, txn->mt_next_pgno), MDBX_SYNC_NONE); + pgno_align2os_bytes(env, txn->mt_next_pgno), MDBX_SYNC_KICK); if (unlikely(rc != MDBX_SUCCESS)) goto bailout; dpl_clear(txn->tw.dirtylist); @@ -5920,7 +5920,7 @@ __cold static int map_resize(MDBX_env *env, const pgno_t used_pgno, env->me_lck->mti_pgop_stat.msync.weak += 1; #endif /* MDBX_ENABLE_PGOP_STAT */ rc = osal_msync(&env->me_dxb_mmap, 0, pgno_align2os_bytes(env, used_pgno), - MDBX_SYNC_NONE); + MDBX_SYNC_KICK); if (unlikely(rc != MDBX_SUCCESS)) goto bailout; } @@ -11978,7 +11978,7 @@ static int sync_locked(MDBX_env *env, unsigned flags, MDBX_meta *const pending, rc = MDBX_RESULT_FALSE /* carry steady */; if (atomic_load64(&env->me_lck->mti_unsynced_pages, mo_Relaxed)) { eASSERT(env, ((flags ^ env->me_flags) & MDBX_WRITEMAP) == 0); - enum osal_syncmode_bits mode_bits = MDBX_SYNC_NONE; + enum osal_syncmode_bits mode_bits = MDBX_SYNC_KICK; unsigned sync_op = 0; if ((flags & MDBX_SAFE_NOSYNC) == 0) { sync_op = 1; @@ -12129,7 +12129,7 @@ static int sync_locked(MDBX_env *env, unsigned flags, MDBX_meta *const pending, #endif /* MDBX_ENABLE_PGOP_STAT */ rc = osal_msync(&env->me_dxb_mmap, 0, pgno_align2os_bytes(env, NUM_METAS), (flags & MDBX_NOMETASYNC) - ? MDBX_SYNC_NONE + ? MDBX_SYNC_KICK : MDBX_SYNC_DATA | MDBX_SYNC_IODQ); } else { #if MDBX_ENABLE_PGOP_STAT @@ -13533,7 +13533,7 @@ __cold static int setup_lck(MDBX_env *env, pathchar_t *lck_pathname, #if MDBX_ENABLE_PGOP_STAT lck->mti_pgop_stat.wops.weak = 1; #endif /* MDBX_ENABLE_PGOP_STAT */ - err = osal_msync(&env->me_lck_mmap, 0, (size_t)size, MDBX_SYNC_NONE); + err = osal_msync(&env->me_lck_mmap, 0, (size_t)size, MDBX_SYNC_KICK); if (unlikely(err != MDBX_SUCCESS)) { ERROR("initial-%s for lck-file failed", "msync"); goto bailout; diff --git a/src/osal.c b/src/osal.c index 3099a269..b1e6ded4 100644 --- a/src/osal.c +++ b/src/osal.c @@ -1560,7 +1560,7 @@ MDBX_INTERNAL_FUNC int osal_fsync(mdbx_filehandle_t fd, * see http://www.spinics.net/lists/linux-ext4/msg33714.html */ while (1) { switch (mode_bits & (MDBX_SYNC_DATA | MDBX_SYNC_SIZE)) { - case MDBX_SYNC_NONE: + case MDBX_SYNC_KICK: return MDBX_SUCCESS /* nothing to do */; #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 case MDBX_SYNC_DATA: @@ -1714,7 +1714,7 @@ MDBX_INTERNAL_FUNC int osal_msync(const osal_mmap_t *map, size_t offset, // so just leave such optimization to the libc discretion. // // assert(linux_kernel_version > 0x02061300); - // if (mode_bits == MDBX_SYNC_NONE) + // if (mode_bits == MDBX_SYNC_KICK) // return MDBX_SUCCESS; #endif /* Linux */ if (msync(ptr, length, (mode_bits & MDBX_SYNC_DATA) ? MS_SYNC : MS_ASYNC)) diff --git a/src/osal.h b/src/osal.h index fad805b4..aaa7809a 100644 --- a/src/osal.h +++ b/src/osal.h @@ -520,7 +520,7 @@ osal_thread_create(osal_thread_t *thread, MDBX_INTERNAL_FUNC int osal_thread_join(osal_thread_t thread); enum osal_syncmode_bits { - MDBX_SYNC_NONE = 0, + MDBX_SYNC_KICK = 0, MDBX_SYNC_DATA = 1, MDBX_SYNC_SIZE = 2, MDBX_SYNC_IODQ = 4