[gvfs] smb: Limit blocksize for reading to 65534 to get better performance
- From: Tomas Bzatek <tbzatek src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gvfs] smb: Limit blocksize for reading to 65534 to get better performance
- Date: Thu, 20 Aug 2009 14:48:12 +0000 (UTC)
commit ce19f20cbb9527131c1d58a1a9565712c4723fa7
Author: Tomas Bzatek <tbzatek redhat com>
Date: Thu Aug 20 16:44:07 2009 +0200
smb: Limit blocksize for reading to 65534 to get better performance
"The current code is incredibly inefficient against CIFS servers.
It asks for a 65535 byte read, which against Windows servers we must
translate into a 65534 byte read (Windows max) followed by a 1 byte read."
See bug 588391 for details.
daemon/gvfsbackendsmb.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 14a5a58..ae547ab 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -723,12 +723,14 @@ do_read (GVfsBackend *backend,
ssize_t res;
smbc_read_fn smbc_read;
- /* For some reason requests of 65536 bytes broke for me (returned 0)
- * Maybe some smb protocol limit
+ /* libsmbclient limits blocksize to (64*1024)-2 for Windows servers,
+ * let's do the same here to achieve reasonable performance. (#588391)
+ *
+ * TODO: port to pull mechanism (#592468)
*/
- if (bytes_requested > 65535)
- bytes_requested = 65535;
-
+ if (bytes_requested > 65534)
+ bytes_requested = 65534;
+
smbc_read = smbc_getFunctionRead (op_backend->smb_context);
res = smbc_read (op_backend->smb_context, (SMBCFILE *)handle, buffer, bytes_requested);
@@ -738,7 +740,6 @@ do_read (GVfsBackend *backend,
{
g_vfs_job_read_set_size (job, res);
g_vfs_job_succeeded (G_VFS_JOB (job));
-
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]