commit: add logic for .payload-link

When a new object is added to the repository, create a
$PAYLOAD-SHA256.payload-link symlink file as well.  The target of the
symlink is the checksum of the object that was added the repository.

Whenever we add a new object file, in addition to lookup if the file is
already present with the same checksum we also check if an object with
the same payload is in the repository.

If a file with the same payload is already present in the repository, we
copy it with `glnx_regfile_copy_bytes` that internally attempts to
create a reflink (ioctl (..., FICLONE, ..)) to the target file if the
file system supports it.  This enables to have objects that share the
payload but have a different inode and xattrs.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1443
Approved by: cgwalters
This commit is contained in:
Giuseppe Scrivano authored and Atomic Bot committed 2018-03-07 18:28:59 +00:00
1 parent 118f1f7e40
commit 127d8bb846
6 files changed
+388 -8

No files matched your search

+7
View File
@@ -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>