coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] cp: use reflink=auto mode by default


From: Alexandru Moise
Subject: [PATCH] cp: use reflink=auto mode by default
Date: Sun, 26 Jun 2016 20:07:06 +0300

On some filesystems (BTRFS), copying a file within the filesystem may
cross subvolume boundaries and we can use a lightweight reflink copy,
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     | 3 +++
 src/cp.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index b6c5c06..76c0127 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,9 @@ GNU coreutils NEWS                                    -*- 
outline -*-
 
 ** Improvements
 
+   cp will try a reflink before falling back to a standard copy, which is
+   more efficient when copying files across BTRFS subvolume boundaries.
+
    stat and tail now know about "prl_fs" (a parallels file system),
    "m1fs" (a Plexistor file system), "wslfs" (Windows Subsystem for Linux),
    and "smb2".  stat -f --format=%T now reports the file system type, and
diff --git a/src/cp.c b/src/cp.c
index 3b5b6cb..073d23e 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -782,7 +782,7 @@ cp_option_init (struct cp_options *x)
   x->interactive = I_UNSPECIFIED;
   x->move_mode = false;
   x->one_file_system = false;
-  x->reflink_mode = REFLINK_NEVER;
+  x->reflink_mode = REFLINK_AUTO;
 
   x->preserve_ownership = false;
   x->preserve_links = false;
-- 
2.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]