>From 31e78c15094468cc60e6b52a7b50d78495825b13 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 24 Sep 2014 11:15:05 +0100 Subject: [PATCH] mv: use reflink=auto mode by default On some filesystems (BTRFS), moving a file within the filesystem may cross subvolume boundaries and we can use the lightweight reflink copy, similar to what cp(1) does. This is typically faster than the full file copy. It's turned on 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 | 3 +++ src/mv.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/NEWS b/NEWS index f25aaaf..077c5fc 100644 --- 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. diff --git a/src/mv.c b/src/mv.c index 6112419..2eacb2c 100644 --- 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; -- 1.7.7.6