[ovs-dev] [PATCH] Switch ovsdb log fsync to data only
William Tu
u9012063 at gmail.com
Tue Apr 21 16:04:23 UTC 2020
On Tue, Apr 21, 2020 at 09:23:57AM +0100, anton.ivanov at cambridgegreys.com wrote:
> From: Anton Ivanov <anton.ivanov at cambridgegreys.com>
>
> 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 at cambridgegreys.com>
LGTM,
But how do you know we do not check mtime or atime of the ovsdb log file?
If there isn't a lot of performance overhead updating the metadata,
why not keep it as it is now?
William
> ---
> ovsdb/log.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> 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;
> --
> 2.20.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
More information about the dev
mailing list