summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@cloudera.com>2014-09-11 11:21:28 -0700
committerPhilip Langdale <philipl@overt.org>2014-10-07 20:25:01 -0700
commitc08bf598dd2723a6ea8d9f1a493a959df1239cd6 (patch)
tree704d321be536a5db696d575824892442b2535e3d
parent33cb19f5aeec85d3cdcb0245927a9f174466a327 (diff)
downloadgvfs-c08bf598dd2723a6ea8d9f1a493a959df1239cd6.tar.gz
MTP: Work around slow large file transfers to Android devices
I've observed that on at least some Android devices, copying large files is very very slow. I don't know if this hardware or MTP stack specific but it's a very real phenomenon. Files under 4GB copy at normal speeds, as do copies from the device to the host at any size. To avoid this, we can avoid using SendObject and instead take advantage of the Android Direct I/O extensions. It may turn out to be desirable to make a similar change for GetObject, and/or < 4GB transfers. https://bugzilla.gnome.org/show_bug.cgi?id=736495
-rw-r--r--daemon/gvfsbackendmtp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index e049233c..8f1c4df6 100644
--- a/daemon/gvfsbackendmtp.c
+++ b/daemon/gvfsbackendmtp.c
@@ -1767,6 +1767,18 @@ do_push (GVfsBackend *backend,
goto exit;
}
+ /*
+ * Don't do this for >=4GB files with android extensions. Some devices
+ * have trouble transferring large files this way. eg: Nexus 5.
+ */
+ if (g_file_info_get_size (info) > G_MAXUINT32 &&
+ G_VFS_BACKEND_MTP (backend)->android_extension) {
+ g_vfs_job_failed_literal (G_VFS_JOB (job),
+ G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ _("Operation unsupported"));
+ goto exit;
+ }
+
gboolean source_is_dir =
g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY;