summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Antill <james@and.org>2014-06-02 16:31:58 -0400
committerColin Walters <walters@verbum.org>2014-06-03 15:41:02 -0400
commitf22fa92aef0cf7334d09addacfdfc70c9f10e075 (patch)
treea16ed44401ea462fb6ffb7953a79de6fd07bd0c0
parentb4d21e9406b1bd178f9a9875ba145c48a9591311 (diff)
downloadostree-f22fa92aef0cf7334d09addacfdfc70c9f10e075.tar.gz
Add --disable-fsync option to both commit and pull (non-local)
On some storage configurations, fsync() can be extremely expensive. Developers and users with slow hard drives may want the ability to opt for speed over safety. Furthermore, many production servers have UPS and stable kernels, and the risk of not fsync'ing in that scenario is fairly low. These users should also be able to opt out.
-rw-r--r--src/ostree/ot-builtin-commit.c4
-rw-r--r--src/ostree/ot-builtin-pull.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c
index 6f632056..fb11a056 100644
--- a/src/ostree/ot-builtin-commit.c
+++ b/src/ostree/ot-builtin-commit.c
@@ -46,6 +46,7 @@ static char **opt_key_ids;
static char *opt_gpg_homedir;
#endif
static gboolean opt_generate_sizes;
+static gboolean opt_disable_fsync;
static GOptionEntry options[] = {
{ "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, "One line subject", "subject" },
@@ -67,6 +68,7 @@ static GOptionEntry options[] = {
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "homedir"},
#endif
{ "generate-sizes", 0, 0, G_OPTION_ARG_NONE, &opt_generate_sizes, "Generate size information along with commit metadata", NULL },
+ { "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
{ NULL }
};
@@ -326,6 +328,8 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
flags |= OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS;
if (opt_generate_sizes)
flags |= OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES;
+ if (opt_disable_fsync)
+ ostree_repo_set_disable_fsync (repo, TRUE);
if (flags != 0
|| opt_owner_uid >= 0
diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c
index a29bbb73..4ed1a151 100644
--- a/src/ostree/ot-builtin-pull.c
+++ b/src/ostree/ot-builtin-pull.c
@@ -27,7 +27,10 @@
#include "ostree.h"
#include "otutil.h"
+static gboolean opt_disable_fsync;
+
static GOptionEntry options[] = {
+ { "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
{ NULL }
};
@@ -54,6 +57,8 @@ ostree_builtin_pull (int argc, char **argv, OstreeRepo *repo, GCancellable *canc
goto out;
}
+ if (opt_disable_fsync)
+ ostree_repo_set_disable_fsync (repo, TRUE);
if (strchr (argv[1], ':') == NULL)
{