[vlc-commits] smb2: limit the read size

Thomas Guillem git at videolan.org
Mon Feb 10 10:04:48 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Feb  7 18:54:12 2020 +0100| [083a78510ea85023f861932047d920bddb0f091d] | committer: Thomas Guillem

smb2: limit the read size

This fixes slow probing/seeking when using prefetch since it requests big data
size (16MB) for each read().

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=083a78510ea85023f861932047d920bddb0f091d
---

 modules/access/smb2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index 3c3d4ff141..d287493e4f 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -241,6 +241,12 @@ FileRead(stream_t *access, void *buf, size_t len)
     if (sys->eof)
         return 0;
 
+    /* Limit the read size since smb2_read_async() will complete only after
+     * reading the whole requested data and not when whatever data is available
+     * (high read size means a faster I/O but a higher latency). */
+    if (len > 262144)
+        len = 262144;
+
     sys->res.read.len = 0;
     if (smb2_read_async(sys->smb2, sys->smb2fh, buf, len,
                         smb2_read_cb, access) < 0)



More information about the vlc-commits mailing list