Add MDB_FDATASYNC to allow override to fsync if needed.

vmware
Howard Chu 13 years ago
parent 291c0ce2db
commit 29de655bc4
  1. 9
      libraries/libmdb/mdb.c

@ -200,6 +200,13 @@
#ifndef MDB_DSYNC #ifndef MDB_DSYNC
# define MDB_DSYNC O_DSYNC # define MDB_DSYNC O_DSYNC
#endif #endif
#endif
/** Function for flushing the data of a file. Define this to fsync
* if fdatasync() is not supported.
*/
#ifndef MDB_FDATASYNC
# define MDB_FDATASYNC fdatasync
#endif #endif
/** A page number in the database. /** A page number in the database.
@ -1283,7 +1290,7 @@ mdb_env_sync(MDB_env *env, int force)
{ {
int rc = 0; int rc = 0;
if (force || !F_ISSET(env->me_flags, MDB_NOSYNC)) { if (force || !F_ISSET(env->me_flags, MDB_NOSYNC)) {
if (fdatasync(env->me_fd)) if (MDB_FDATASYNC(env->me_fd))
rc = ErrCode(); rc = ErrCode();
} }
return rc; return rc;

Loading…
Cancel
Save