mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
More cleanup for fdatasync hack
This commit is contained in:
parent
e85c944a3a
commit
bf3961e3c7
@ -81,7 +81,9 @@ extern int cacheflush(char *addr, int nbytes, int cache);
|
|||||||
|
|
||||||
#if defined(__linux) && !defined(MDB_FDATASYNC_WORKS)
|
#if defined(__linux) && !defined(MDB_FDATASYNC_WORKS)
|
||||||
/** fdatasync is broken on ext3/ext4fs on older kernels, see
|
/** fdatasync is broken on ext3/ext4fs on older kernels, see
|
||||||
* description in #mdb_env_open2 comments
|
* description in #mdb_env_open2 comments. You can safely
|
||||||
|
* define MDB_FDATASYNC_WORKS if this code will only be run
|
||||||
|
* on kernels 3.6 and newer.
|
||||||
*/
|
*/
|
||||||
#define BROKEN_FDATASYNC
|
#define BROKEN_FDATASYNC
|
||||||
#endif
|
#endif
|
||||||
@ -1102,6 +1104,8 @@ struct MDB_env {
|
|||||||
#define MDB_ENV_ACTIVE 0x20000000U
|
#define MDB_ENV_ACTIVE 0x20000000U
|
||||||
/** me_txkey is set */
|
/** me_txkey is set */
|
||||||
#define MDB_ENV_TXKEY 0x10000000U
|
#define MDB_ENV_TXKEY 0x10000000U
|
||||||
|
/** fdatasync is unreliable */
|
||||||
|
#define MDB_FSYNCONLY 0x08000000U
|
||||||
uint32_t me_flags; /**< @ref mdb_env */
|
uint32_t me_flags; /**< @ref mdb_env */
|
||||||
unsigned int me_psize; /**< DB page size, inited from me_os_psize */
|
unsigned int me_psize; /**< DB page size, inited from me_os_psize */
|
||||||
unsigned int me_os_psize; /**< OS page size, from #GET_PAGESIZE */
|
unsigned int me_os_psize; /**< OS page size, from #GET_PAGESIZE */
|
||||||
@ -1148,9 +1152,6 @@ struct MDB_env {
|
|||||||
#elif defined(MDB_USE_POSIX_SEM)
|
#elif defined(MDB_USE_POSIX_SEM)
|
||||||
sem_t *me_rmutex; /* Shared mutexes are not supported */
|
sem_t *me_rmutex; /* Shared mutexes are not supported */
|
||||||
sem_t *me_wmutex;
|
sem_t *me_wmutex;
|
||||||
#endif
|
|
||||||
#ifdef BROKEN_FDATASYMC
|
|
||||||
int me_fsynconly; /**< fdatasync is unreliable */
|
|
||||||
#endif
|
#endif
|
||||||
void *me_userctx; /**< User-settable context */
|
void *me_userctx; /**< User-settable context */
|
||||||
MDB_assert_func *me_assert_func; /**< Callback for assertion failures */
|
MDB_assert_func *me_assert_func; /**< Callback for assertion failures */
|
||||||
@ -2325,7 +2326,7 @@ mdb_env_sync(MDB_env *env, int force)
|
|||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef BROKEN_FDATASYNC
|
#ifdef BROKEN_FDATASYNC
|
||||||
if (env->me_fsynconly) {
|
if (env->me_flags & MDB_FSYNCONLY) {
|
||||||
if (fsync(env->me_fd))
|
if (fsync(env->me_fd))
|
||||||
rc = ErrCode();
|
rc = ErrCode();
|
||||||
} else
|
} else
|
||||||
@ -3931,7 +3932,7 @@ mdb_env_open2(MDB_env *env)
|
|||||||
} else { /* 4.x and newer is OK */
|
} else { /* 4.x and newer is OK */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
env->me_fsynconly = 1;
|
env->me_flags |= MDB_FSYNCONLY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user