summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfsfileengine_unix.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-02-22 12:46:59 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2017-02-24 11:35:25 +0000
commitd5078161aadac7bb36862d8eb0d6d8c27eb58c60 (patch)
treeb33fd1d0f0bd2515c3db6a1c0c94d34be7622c51 /src/corelib/io/qfsfileengine_unix.cpp
parentf971a0d65cc4bc64dc61bdd2a4b659b382eb996f (diff)
Speed up QFile::copy on Linux file systems that support cloning
Originally inherited from Btrfs, recent Linux kernels have a system call that allows cloning the contents of a file from another one if the underlying file system supports it. Change-Id: I9df66b65faef99f3bbed8a88fb6b6009baeef32e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qfsfileengine_unix.cpp')
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index ca5af924e9..ff77278dc1 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -780,6 +780,23 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr)
#endif
}
+/*!
+ \reimp
+*/
+bool QFSFileEngine::clone(int sourceHandle)
+{
+#if defined(Q_OS_LINUX)
+ Q_D(QFSFileEngine);
+# if !defined FICLONE
+# define FICLONE _IOW (0x94, 9, int)
+# endif
+ return ::ioctl(d->fd, FICLONE, sourceHandle) == 0;
+#else
+ Q_UNUSED(sourceHandle);
+ return false;
+#endif
+}
+
QT_END_NAMESPACE
#endif // QT_NO_FSFILEENGINE