[ostree] repo: Support fsync=false configuration
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: Support fsync=false configuration
- Date: Thu, 5 Jun 2014 21:36:08 +0000 (UTC)
commit 51bf1fab0f96c4b40bbe9048a1fb81f9037ee5b6
Author: Colin Walters <walters verbum org>
Date: Wed Jun 4 09:59:47 2014 -0400
repo: Support fsync=false configuration
See rationale in the updated docs. Basically developer use cases as
well as UPS-backed servers.
doc/ostree.repo-config.xml | 24 ++++++++++++++++++++++++
src/libostree/ostree-repo.c | 11 +++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/doc/ostree.repo-config.xml b/doc/ostree.repo-config.xml
index d2f6542..621879c 100644
--- a/doc/ostree.repo-config.xml
+++ b/doc/ostree.repo-config.xml
@@ -83,6 +83,30 @@ Boston, MA 02111-1307, USA.
<term><varname>repo_version</varname></term>
<listitem><para>Currently, this must be set to <literal>1</literal>.</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><varname>fsync</varname></term>
+ <listitem><para>Boolean value controlling whether or not to
+ ensure files are on stable storage when performing operations
+ such as commits, pulls, and checkouts. Defaults to
+ <literal>true</literal>.</para>
+ <para>
+ If you disable fsync, OSTree will no longer be robust
+ against kernel crashes or power loss.
+ </para>
+ <para>
+ You might choose to disable this for local development
+ repositories, under the assumption they can be recreated from
+ source. Similarly, you could disable for a mirror where you could
+ re-pull.
+ </para>
+ <para>
+ For the system repository, you might choose to disable fsync
+ if you have uninterruptable power supplies and a well tested
+ kernel.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 210ce36..aa2bd2d 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -683,6 +683,17 @@ ostree_repo_open (OstreeRepo *self,
goto out;
{
+ gboolean do_fsync;
+
+ if (!ot_keyfile_get_boolean_with_default (self->config, "core", "fsync",
+ TRUE, &do_fsync, error))
+ goto out;
+
+ if (!do_fsync)
+ ostree_repo_set_disable_fsync (self, TRUE);
+ }
+
+ {
gs_unref_object GFile *default_repo_path = get_default_repo_path ();
if (g_file_equal (self->repodir, default_repo_path))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]