diff options
author | Mikael Ronstrom <mikael@dator8> | 2010-10-28 18:27:25 +0200 |
---|---|---|
committer | Mikael Ronstrom <mikael@dator8> | 2010-10-28 18:27:25 +0200 |
commit | c0854c3e1746f81abcba27505c7f8adc09ff2c45 (patch) | |
tree | 1e3dd78b44bfef3d1a6bde907ae3c82067dbe686 /mysys/my_sync.c | |
parent | 8fbf0e8817d7dc0f21e0ea33ed391e2260d7f463 (diff) | |
download | mariadb-git-c0854c3e1746f81abcba27505c7f8adc09ff2c45.tar.gz |
Added reporting of fsync to THD wait interface
Diffstat (limited to 'mysys/my_sync.c')
-rw-r--r-- | mysys/my_sync.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mysys/my_sync.c b/mysys/my_sync.c index bc050922ffc..6a4e26a6542 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -17,6 +17,16 @@ #include "mysys_err.h" #include <errno.h> +static void (*before_sync_wait)(void)= 0; +static void (*after_sync_wait)(void)= 0; + +void thr_set_sync_wait_callback(void (*before_wait)(void), + void (*after_wait)(void)) +{ + before_sync_wait= before_wait; + after_sync_wait= after_wait; +} + /* Sync data in file to disk @@ -48,6 +58,8 @@ int my_sync(File fd, myf my_flags) do { + if (before_sync_wait) + (*before_sync_wait)(); #if defined(F_FULLFSYNC) /* In Mac OS X >= 10.3 this call is safer than fsync() (it forces the @@ -75,6 +87,8 @@ int my_sync(File fd, myf my_flags) int er= errno; if (!(my_errno= er)) my_errno= -1; /* Unknown error */ + if (after_sync_wait) + (*after_sync_wait)(); if ((my_flags & MY_IGNORE_BADFD) && (er == EBADF || er == EINVAL || er == EROFS)) { @@ -84,6 +98,11 @@ int my_sync(File fd, myf my_flags) else if (my_flags & MY_WME) my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno); } + else + { + if (after_sync_wait) + (*after_sync_wait)(); + } DBUG_RETURN(res); } /* my_sync */ |