summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-checkout.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2016-06-26 10:25:03 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2016-06-27 13:08:46 +0000
commit439069b2bbe268fae7010e2fcb67c57d914cc22f (patch)
tree898400f7ae337a2712ed61ae75970ab3c41eda04 /src/ostree/ot-builtin-checkout.c
parentda989b473dc6b812646b65437f96ff5b9e3af3a4 (diff)
downloadostree-439069b2bbe268fae7010e2fcb67c57d914cc22f.tar.gz
checkout: Add an option to require hardlinks
I've seen a few people hit this and wonder why checkouts are slow/take space. Really, ensuring this happens is the *point* of OSTree. Physical copies should be a last resort fallback for very unusual situations (one of those is rpm-ostree checking out the db since librpm doesn't know how to read from libostree). Even I hit the fact that `/var` is a mountpoint disallowing hardlinks with `/ostree` once and was confused. =) Add this to the rofiles-fuse test case because it creates a mount point. Closes: #368 Approved by: jlebon
Diffstat (limited to 'src/ostree/ot-builtin-checkout.c')
-rw-r--r--src/ostree/ot-builtin-checkout.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c
index 810a8f72..c6fdf1fc 100644
--- a/src/ostree/ot-builtin-checkout.c
+++ b/src/ostree/ot-builtin-checkout.c
@@ -40,6 +40,7 @@ static gboolean opt_whiteouts;
static gboolean opt_from_stdin;
static char *opt_from_file;
static gboolean opt_disable_fsync;
+static gboolean opt_require_hardlinks;
static gboolean
parse_fsync_cb (const char *option_name,
@@ -67,6 +68,7 @@ static GOptionEntry options[] = {
{ "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" },
+ { "require-hardlinks", 'H', 0, G_OPTION_ARG_NONE, &opt_require_hardlinks, "Do not fall back to full copies if hardlinking fails", NULL },
{ NULL }
};
@@ -85,7 +87,7 @@ process_one_checkout (OstreeRepo *repo,
* `ostree_repo_checkout_tree_at` until such time as we have a more
* convenient infrastructure for testing C APIs with data.
*/
- if (opt_disable_cache || opt_whiteouts)
+ if (opt_disable_cache || opt_whiteouts || opt_require_hardlinks)
{
OstreeRepoCheckoutOptions options = { 0, };
@@ -97,6 +99,7 @@ process_one_checkout (OstreeRepo *repo,
options.process_whiteouts = TRUE;
if (subpath)
options.subpath = subpath;
+ options.no_copy_fallback = opt_require_hardlinks;
if (!ostree_repo_checkout_tree_at (repo, &options,
AT_FDCWD, destination,