diff options
author | unknown <heikki@donna.mysql.fi> | 2001-05-14 17:45:38 +0300 |
---|---|---|
committer | unknown <heikki@donna.mysql.fi> | 2001-05-14 17:45:38 +0300 |
commit | 258a55ff6884b85e06714090947bdb53160811b9 (patch) | |
tree | 9f23c60745ead59c32aaaa78f1bf43a1c4051dcb /innobase | |
parent | f59a561f12aa9c377c8960cc8c2277ad047e1ebf (diff) | |
download | mariadb-git-258a55ff6884b85e06714090947bdb53160811b9.tar.gz |
os0file.c Use O_SYNC if possible, second choice fdatasync, and last choice fsync
configure.in Check if fdatasync exists
manual.texi Updated defragmenting doc
manual.texi Corrected fillfactor contract threashold for a page to 1/2
Docs/manual.texi:
Updated defragmenting doc
innobase/configure.in:
Check if fdatasync exists
innobase/os/os0file.c:
Use O_SYNC if possible, second choice fdatasync, and last choice fsync
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/configure.in | 1 | ||||
-rw-r--r-- | innobase/os/os0file.c | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/innobase/configure.in b/innobase/configure.in index 2ed456ff0b1..83d302c6dc4 100644 --- a/innobase/configure.in +++ b/innobase/configure.in @@ -37,6 +37,7 @@ AC_PROG_INSTALL AC_CHECK_HEADERS(aio.h sched.h) AC_CHECK_SIZEOF(int, 4) AC_CHECK_FUNCS(sched_yield) +AC_CHECK_FUNCS(fdatasync) #AC_C_INLINE Already checked in MySQL AC_C_BIGENDIAN diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index b3cb86a1178..065d9b6f553 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -299,6 +299,13 @@ try_again: UT_NOT_USED(purpose); + /* On Linux opening a file in the O_SYNC mode seems to be much + more efficient than calling an explicit fsync or fdatasync after + each write */ + +#ifdef O_SYNC + create_flag = create_flag | O_SYNC; +#endif if (create_mode == OS_FILE_CREATE) { file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); @@ -492,8 +499,18 @@ os_file_flush( #else int ret; - ret = fsync(file); +#ifdef O_SYNC + /* We open all files with the O_SYNC option, which means there + should be no need for fsync or fdatasync. In practice such a need + may be because on a Linux Xeon computer "donna" the OS seemed to be + fooled to believe that 500 disk writes/second are possible. */ + ret = 0; +#elif defined(HAVE_FDATASYNC) + ret = fdatasync(file); +#else + ret = fsync(file); +#endif if (ret == 0) { return(TRUE); } |