diff options
author | Anton Ivanov <anton.ivanov@cambridgegreys.com> | 2020-04-21 09:23:57 +0100 |
---|---|---|
committer | William Tu <u9012063@gmail.com> | 2020-04-27 08:36:39 -0700 |
commit | 3738d9298fe788409f732f8e111ffcd204070da3 (patch) | |
tree | 6016b0dd24939ba8bf9552368dc632956c8f7058 /ovsdb/log.c | |
parent | 542dbc5a185407e4b3aef000f043fa2c653ccc12 (diff) | |
download | openvswitch-3738d9298fe788409f732f8e111ffcd204070da3.tar.gz |
ovsdb: Switch ovsdb log fsync to data only.
We do not check metadata - mtime, atime, anywhere, so we
do not need to update it every time we sync the log.
if the system supports it, the log update should be
data only
Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Diffstat (limited to 'ovsdb/log.c')
-rw-r--r-- | ovsdb/log.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ovsdb/log.c b/ovsdb/log.c index c82a79c9f..41af77679 100644 --- a/ovsdb/log.c +++ b/ovsdb/log.c @@ -658,7 +658,16 @@ ovsdb_log_write_and_free(struct ovsdb_log *log, struct json *json) struct ovsdb_error * ovsdb_log_commit_block(struct ovsdb_log *file) { +#if (_POSIX_C_SOURCE >= 199309L || _XOPEN_SOURCE >= 500) + /* we do not check metadata - mtime, atime, anywhere, so we + * do not need to update it every time we sync the log. + * if the system supports it, the log update should be + * data only + */ + if (file->stream && fdatasync(fileno(file->stream))) { +#else if (file->stream && fsync(fileno(file->stream))) { +#endif return ovsdb_io_error(errno, "%s: fsync failed", file->display_name); } return NULL; |