]> git.proxmox.com Git - ovs.git/commitdiff
ovsdb: Switch ovsdb log fsync to data only.
authorAnton Ivanov <anton.ivanov@cambridgegreys.com>
Tue, 21 Apr 2020 08:23:57 +0000 (09:23 +0100)
committerWilliam Tu <u9012063@gmail.com>
Mon, 27 Apr 2020 15:36:39 +0000 (08:36 -0700)
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>
ovsdb/log.c

index c82a79c9ffeede9e9048e2c7cbe6f50f8743169d..41af776791789cae43227616499c6624c6dd955e 100644 (file)
@@ -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;