GNOME Bugzilla – Bug 757117
disable fsync for checkout for deployments
Last modified: 2016-01-13 18:23:53 UTC
Now that we're using syncfs(), I don't see a reason to fsync() the directories anymore.
My first thought was that it would be safe to remove all of the blocks starting with `if (!self->disable_fsync)` in ostree-repo-checkout.c, but I now realize that this would change the behavior when ostree_repo_checkout_tree() or ostree_repo_checkout_tree_at() is used in a case other than creating a deployment, since there may not be any syncfs() calls afterward. My second idea is to call ostree_repo_set_disable_fsync(repo, TRUE) in checkout_deployment_tree(), but doing this safely would also require storing the previous value of repo->disable_fsync so that it can be restored to its previous state before ostree_repo_set_disable_fsync() returns. This is certainly doable but is a bit messy. Colin, do you have any thoughts on this? Am I at least right that this would do the right thing?
Broadly speaking I think we should encourage API users to ostree_repo_set_disable_fsync(repo, TRUE) and to synchronize externally if desired. For the instance of OstreeRepo is owned by OstreeSysroot we could consider just unconditionally disabling fsync there. The tricky part is that instance can and is exposed externally, so probably for backwards compat we'd need to perhaps create another instance when ostree_sysroot_get_repo() is invoked or so? That said the second model (disable/enable) might just be simpler.
https://github.com/GNOME/ostree/pull/168