[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] mv: use reflink=auto mode by default
From: |
David Sterba |
Subject: |
[PATCH] mv: use reflink=auto mode by default |
Date: |
Wed, 24 Sep 2014 11:35:12 +0200 |
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 during
the fall back copy and does not break user expectations or usability.
* src/mv.c (main): Set the reflink mode to AUTO.
---
src/mv.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/mv.c b/src/mv.c
index 6112419e2896..13924f177d19 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -329,6 +329,12 @@ The backup suffix is '~', unless set with --suffix or
SIMPLE_BACKUP_SUFFIX.\n\
The version control method may be selected via the --backup option or
through\n\
the VERSION_CONTROL environment variable. Here are the values:\n\
\n\
+On some filesystems (btrfs), moving a file within the filesystem may cross\n\
+subvolume boundaries. This will prevent a simple rename and would fall back\n\
+to a full file copy. However, this is not strictly necessary, because the\n\
+lightweight \"reflink\" copy can be used instead. This is typically faster\n\
+as it does not touch the data blocks. This behaviour is default and handled\n\
+transparently if the filesystem does not support reflink.\n\
"), stdout);
fputs (_("\
none, off never make backups (even if --backup is given)\n\
@@ -366,6 +372,9 @@ main (int argc, char **argv)
cp_option_init (&x);
+ /* Try reflink first or fall back to full file copy transparently */
+ x.reflink_mode = REFLINK_AUTO;
+
/* Try to disable the ability to unlink a directory. */
priv_set_remove_linkdir ();
--
2.1.1
- [PATCH] mv: use reflink=auto mode by default,
David Sterba <=