Of course writing epoch log or config rarely happens than writing objects, O_DSYNC for the write should be dropped when the journaling is enabled.
Signed-off-by: Hitoshi Mitake <[email protected]> --- sheep/config.c | 6 +++++- sheep/store.c | 4 ++++ 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/sheep/config.c b/sheep/config.c index 14da875..63c1e81 100644 --- a/sheep/config.c +++ b/sheep/config.c @@ -36,6 +36,7 @@ char *config_path; static int write_config(void) { int fd, ret; + int flags = O_RDWR | O_CREAT | O_DSYNC; if (uatomic_is_true(&sys->use_journal) && journal_write_config((char *)&config, sizeof(config)) @@ -45,7 +46,10 @@ static int write_config(void) sync(); } - fd = open(config_path, O_DSYNC | O_WRONLY | O_CREAT, def_fmode); + if (uatomic_is_true(&sys->use_journal)) + flags &= ~O_DSYNC; + + fd = open(config_path, flags, def_fmode); if (fd < 0) { sd_eprintf("failed to open config file, %m"); return SD_RES_EIO; diff --git a/sheep/store.c b/sheep/store.c index cd143f4..f8eee59 100644 --- a/sheep/store.c +++ b/sheep/store.c @@ -61,6 +61,10 @@ int update_epoch_log(uint32_t epoch, struct sd_node *nodes, size_t nr_nodes) } snprintf(path, sizeof(path), "%s%08u", epoch_path, epoch); + + if (uatomic_is_true(&sys->use_journal)) + flags &= ~O_DSYNC; + fd = open(path, flags, def_fmode); if (fd < 0) { free(buf); -- 1.7.2.5 -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
