[gvfs] MTP: Work around slow large file transfers to Android devices



commit c08bf598dd2723a6ea8d9f1a493a959df1239cd6
Author: Philip Langdale <philipl cloudera com>
Date:   Thu Sep 11 11:21:28 2014 -0700

    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

 daemon/gvfsbackendmtp.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index e049233..8f1c4df 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;
 


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