Skip to content

Commit

Permalink
libostree: new repo configuration payload-link-threshold
Browse files Browse the repository at this point in the history
sets a minimum file size threshold for payload link files to be
created.

A payload-link file is created only for bigger that are >=
payload-link-threshold.

By default the payload-link-threshold value is G_MAXUINT64 that disables
the feature.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Feb 14, 2018
1 parent 46f3278 commit 5c1a2a0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions man/ostree.repo-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ Boston, MA 02111-1307, USA.
</listitem>
</varlistentry>

<varlistentry>
<term><varname>payload-link-threshold</varname></term>
<listitem><para>An integer value that specifies a minimum file size for creating
a payload link. By default it is disabled.
</para></listitem>
</varlistentry>

</variablelist>
</refsect1>

Expand Down
2 changes: 1 addition & 1 deletion src/libostree/ostree-repo-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ write_content_object (OstreeRepo *self,
cancellable, error))
return FALSE;

if (!has_payload_object && actual_payload_checksum)
if (!has_payload_object && actual_payload_checksum && g_file_info_get_size (file_info) >= self->payload_link_threshold)
{
if (symlinkat (actual_checksum, commit_tmp_dfd (self), actual_payload_checksum) < 0)
{
Expand Down
1 change: 1 addition & 0 deletions src/libostree/ostree-repo-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ struct OstreeRepo {
gchar *collection_id;
gboolean add_remotes_config_dir; /* Add new remotes in remotes.d dir */
gint lock_timeout_seconds;
guint64 payload_link_threshold;

OstreeRepo *parent_repo;
};
Expand Down
9 changes: 9 additions & 0 deletions src/libostree/ostree-repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2827,6 +2827,15 @@ reload_core_config (OstreeRepo *self,
return FALSE;
}

{ g_autofree char *payload_threshold = NULL;

if (!ot_keyfile_get_value_with_default (self->config, "core", "payload-link-threshold", "-1",
&payload_threshold, error))
return FALSE;

self->payload_link_threshold = g_ascii_strtoull (payload_threshold, NULL, 10);
}

return TRUE;
}

Expand Down

0 comments on commit 5c1a2a0

Please sign in to comment.