lib/repo: Add min-free-space-percent option, default 3%

For ostree-as-host, we're the superuser, so we'll blow past
any reserved free space by default.  While deltas have size
metadata, if one happens to do a loose fetch, we can fill
up the disk.

Another case is flatpak: the system helper has similar concerns
here as ostree-as-host, and for `flatpak --user`, we also
want to be nice and avoid filling up the user's quota.

Closes: https://github.com/ostreedev/ostree/issues/962

Closes: #987
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-07-04 16:15:11 +00:00
1 parent 8d4d638e99
commit 1f5ce1a9f7
5 files changed
+94

No files matched your search

+5
View File
@@ -20,6 +20,7 @@
#pragma once
#include <sys/statvfs.h>
#include "ostree-ref.h"
#include "ostree-repo.h"
#include "ostree-remote-private.h"
@@ -102,6 +103,9 @@ struct OstreeRepo {
GHashTable *txn_collection_refs; /* (element-type OstreeCollectionRef utf8) */
GMutex txn_stats_lock;
OstreeRepoTransactionStats txn_stats;
/* Implementation of min-free-space-percent */
gulong txn_blocksize;
fsblkcnt_t max_txn_blocks;
GMutex cache_lock;
guint dirmeta_cache_refcount;
@@ -123,6 +127,7 @@ struct OstreeRepo {
uid_t owner_uid;
uid_t target_owner_uid;
gid_t target_owner_gid;
guint min_free_space_percent;
guint test_error_flags; /* OstreeRepoTestErrorFlags */