]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
mv: use reflink=auto mode by default
authorDavid Sterba <dsterba@suse.cz>
Wed, 24 Sep 2014 10:15:05 +0000 (11:15 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 24 Sep 2014 10:48:22 +0000 (11:48 +0100)
On some filesystems (BTRFS), moving a file within the filesystem may
cross subvolume boundaries and we can use a lightweight reflink copy,
similar to what cp(1) can do, which is faster than a full file copy.
This is enabled by default because it's only an optimization for
the fall back copy and does not break user expectations or usability.

* src/mv.c (cp_option_init): Set the reflink mode to AUTO.
* NEWS: Mention the improvement.

NEWS
src/mv.c

diff --git a/NEWS b/NEWS
index f25aaaf0b9929ac1cfe059c9517501fd43bbb026..077c5fcb9d278a09d800a09fd78a00274968ee8d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,9 @@ GNU coreutils NEWS                                    -*- outline -*-
 
 ** Improvements
 
+  mv will try a reflink before falling back to a standard copy, which is
+  more efficient when moving files across BTRFS subvolume boundaries.
+
   References from --help and the man pages of utilities have been corrected
   in various cases, and more direct links to the corresponding online
   documentation are provided.
index 6112419e2896f4ba94865ad3e3e2b23fd1eddf6f..2eacb2ca60676b2897e0f96d323a9da14fb4eb6a 100644 (file)
--- a/src/mv.c
+++ b/src/mv.c
@@ -107,7 +107,7 @@ cp_option_init (struct cp_options *x)
 
   cp_options_default (x);
   x->copy_as_regular = false;  /* FIXME: maybe make this an option */
-  x->reflink_mode = REFLINK_NEVER;
+  x->reflink_mode = REFLINK_AUTO;
   x->dereference = DEREF_NEVER;
   x->unlink_dest_before_opening = false;
   x->unlink_dest_after_failed_open = false;