From e86072a9c79d7fb5fdf63ffbe7b7a36731f0a11a Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 8 Jan 2015 12:17:29 +0000 Subject: [PATCH] Revert "Note MDB_SAFE_FDATASYNC" This reverts commit 293d6bb47f7f0d54a45d57ce2be3a9595e806dc0. Revert "Simpler fdatasync hack" This reverts commit 9585c012335b2a28fbfdd267bcdeeeea91dc0f08. --- libraries/liblmdb/Makefile | 1 - libraries/liblmdb/mdb.c | 21 +-------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/libraries/liblmdb/Makefile b/libraries/liblmdb/Makefile index 90e4e21..bca5cd3 100644 --- a/libraries/liblmdb/Makefile +++ b/libraries/liblmdb/Makefile @@ -11,7 +11,6 @@ # - MDB_USE_POSIX_SEM # - MDB_DSYNC # - MDB_FDATASYNC -# - MDB_SAFE_FDATASYNC # - MDB_USE_PWRITEV # # There may be other macros in mdb.c of interest. You should diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 16530b9..cc6eaa2 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -368,12 +368,6 @@ static int mdb_mutex_failed(MDB_env *env, mdb_mutex_t *mutex, int rc); */ #ifndef MDB_FDATASYNC # define MDB_FDATASYNC fdatasync -# ifndef MDB_SAFE_FDATASYNC -/** Linux ext3fs and ext4fs don't implement fdatasync correctly - * on older kernels. xfs is known to be safe. https://lkml.org/lkml/2012/9/3/83 - */ -# define MDB_BROKEN_FDATASYNC -# endif #endif #ifndef MDB_MSYNC @@ -1160,7 +1154,7 @@ struct MDB_env { MDB_txn *me_txn; /**< current write transaction */ MDB_txn *me_txn0; /**< prealloc'd write transaction */ size_t me_mapsize; /**< size of the data memory map */ - size_t me_size; /**< current file size */ + off_t me_size; /**< current file size */ pgno_t me_maxpg; /**< me_mapsize / me_psize */ MDB_dbx *me_dbxs; /**< array of static DB info */ uint16_t *me_dbflags; /**< array of flags from MDB_db.md_flags */ @@ -2347,10 +2341,6 @@ fail: return rc; } -#ifdef MDB_BROKEN_FDATASYNC -static int ESECT mdb_fsize(HANDLE fd, size_t *size); -#endif - int mdb_env_sync(MDB_env *env, int force) { @@ -2366,15 +2356,6 @@ mdb_env_sync(MDB_env *env, int force) rc = ErrCode(); #endif } else { -#ifdef MDB_BROKEN_FDATASYNC - size_t sz = 0; - if (mdb_fsize(env->me_fd, &sz) != MDB_SUCCESS || sz != env->me_size) { - if (fsync(env->me_fd)) - rc = ErrCode(); - else if (sz) - env->me_size = sz; - } else -#endif if (MDB_FDATASYNC(env->me_fd)) rc = ErrCode(); }