summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-checkout.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2015-01-06 16:00:27 -0500
committerColin Walters <walters@verbum.org>2015-01-07 11:41:46 -0500
commitf23f556f03f72b966c7a6cc8f4afa03a29d1ea5f (patch)
treeecfdf62c815c832737dd757b53dae827fbd9503d /src/ostree/ot-builtin-checkout.c
parent687a6f8314acf62b4434302a9269cd7a5d2d97a1 (diff)
downloadostree-f23f556f03f72b966c7a6cc8f4afa03a29d1ea5f.tar.gz
checkout: Add --fsync=false
Some use cases for checkouts don't need to fsync during checkout. Installer programs for example will just do a global fsync at the end. In the future, the default "ostree admin" core could also be rearchitected to only do a transaction commit right before reboot, and do the fsync then. https://bugzilla.gnome.org/show_bug.cgi?id=742482
Diffstat (limited to 'src/ostree/ot-builtin-checkout.c')
-rw-r--r--src/ostree/ot-builtin-checkout.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c
index b3284ef8..b6d150ab 100644
--- a/src/ostree/ot-builtin-checkout.c
+++ b/src/ostree/ot-builtin-checkout.c
@@ -29,6 +29,7 @@
#include "ot-builtins.h"
#include "ostree.h"
#include "otutil.h"
+#include "ot-tool-util.h"
static gboolean opt_user_mode;
static gboolean opt_allow_noent;
@@ -36,6 +37,23 @@ static char *opt_subpath;
static gboolean opt_union;
static gboolean opt_from_stdin;
static char *opt_from_file;
+static gboolean opt_disable_fsync;
+
+static gboolean
+parse_fsync_cb (const char *option_name,
+ const char *value,
+ gpointer data,
+ GError **error)
+{
+ gboolean val;
+
+ if (!ot_parse_boolean (option_name, value, &val, error))
+ return FALSE;
+
+ opt_disable_fsync = !val;
+
+ return TRUE;
+}
static GOptionEntry options[] = {
{ "user-mode", 'U', 0, G_OPTION_ARG_NONE, &opt_user_mode, "Do not change file ownership or initialize extended attributes", NULL },
@@ -44,6 +62,7 @@ static GOptionEntry options[] = {
{ "allow-noent", 0, 0, G_OPTION_ARG_NONE, &opt_allow_noent, "Do nothing if specified path does not exist", NULL },
{ "from-stdin", 0, 0, G_OPTION_ARG_NONE, &opt_from_stdin, "Process many checkouts from standard input", NULL },
{ "from-file", 0, 0, G_OPTION_ARG_STRING, &opt_from_file, "Process many checkouts from input file", "FILE" },
+ { "fsync", 0, 0, G_OPTION_ARG_CALLBACK, parse_fsync_cb, "Specify how to invoke fsync()", "POLICY" },
{ NULL }
};
@@ -186,6 +205,9 @@ ostree_builtin_checkout (int argc, char **argv, GCancellable *cancellable, GErro
if (!ostree_option_context_parse (context, options, &argc, &argv, OSTREE_BUILTIN_FLAG_NONE, &repo, cancellable, error))
goto out;
+ if (opt_disable_fsync)
+ ostree_repo_set_disable_fsync (repo, TRUE);
+
if (argc < 2)
{
gchar *help = g_option_context_get_help (context, TRUE, NULL);