Hi! I see requests for cp --reflink=auto as the default happening a lot on the mailing list. But, assuming there is a reason to ever want a heavy-weight copy[1], people might want to disable reflinking. This applies regardless of what's the default: aliases or wrappers can be used for personal preferences.
Thus, if there's alias cp='cp --reflink=auto', there's no obvious way to skip it. Here's a patch that implements --reflink=never, useful to override an earlier argument. Meow! [1]. As a btrfs mailing list regular and occassional kernel/-progs contributor, I can't even think of any; nocow files are already handled. -- ⢀⣴⠾⠻⢶⣦⠀ There's an easy way to tell toy operating systems from real ones. ⣾⠁⢰⠒⠀⣿⡁ Just look at how their shipped fonts display U+1F52B, this makes ⢿⡄⠘⠷⠚⠋⠀ the intended audience obvious. It's also interesting to see OSes ⠈⠳⣄⠀⠀⠀⠀ go back and forth wrt their intended target.
>From adac27b8321907ed784b69be7bb0d7d2486c85de Mon Sep 17 00:00:00 2001 From: Adam Borowski <[email protected]> Date: Mon, 18 Jun 2018 00:38:04 +0200 Subject: [PATCH] cp: --reflink=never to force no-reflink mode This is currently the default, but most if not all users of reflink-capable filesystems want --reflink=auto, which is often encapsulated into an alias. Adding --reflink=never allows overriding such an alias. --- doc/coreutils.texi | 3 +++ src/cp.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index c28b8d043..0691ce6da 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -8740,6 +8740,9 @@ then report the failure for each file and exit with a failure status. @item auto If the copy-on-write operation is not supported then fall back to the standard copy behavior. + +@item never +Disable reflink: perform a heavy-weight copy that takes the full disk space. @end table This option is overridden by the @option{--link}, @option{--symbolic-link} diff --git a/src/cp.c b/src/cp.c index 04cbd4b33..ffb345b24 100644 --- a/src/cp.c +++ b/src/cp.c @@ -96,11 +96,11 @@ ARGMATCH_VERIFY (sparse_type_string, sparse_type); static char const *const reflink_type_string[] = { - "auto", "always", NULL + "auto", "always", "never", NULL }; static enum Reflink_type const reflink_type[] = { - REFLINK_AUTO, REFLINK_ALWAYS + REFLINK_AUTO, REFLINK_ALWAYS, REFLINK_NEVER }; ARGMATCH_VERIFY (reflink_type_string, reflink_type); -- 2.17.1
