Page 1 of 2

Speedup Samba shares

Posted: Mon Feb 17, 2014 6:29 pm
by zoelechat
Since I use SamyGO to access my Samba shares directly from TV, it always have been slow, especially on first browse of virtual device (~40 seconds for ~1000 shared files on 3 computers, increasing proportionally to number). Even next browses are "loading..." (with black screen) for ~15 seconds before displaying anything.

Today, just to make my device list on TV more friendly, I wanted to change virtual device name...
So, I've edited vusb.init script and changed product name from "SamyGo Virt." to "Network".

I don't know why but now, browsing of virtual device is nearly instantaneous! First browse takes ~5 seconds and next ones ~2 seconds. Mostly faster than a physical drive.

I've tried various product names, still as fast. Just revert to "SamyGo Virt." and it is slow again!

I wonder what's wrong with "SamyGO Virt." product name and what can be the explanation!?
Anyway, if this can be useful to anybody annoyed by slowness of access to samba shares, in case I was not the only one concerned... :)

Re: Speedup Samba shares

Posted: Wed Feb 19, 2014 4:41 pm
by juusso
I try to imagine what did you do for sure. Could you please give your init script?

Re: Speedup Samba shares

Posted: Wed Feb 19, 2014 5:11 pm
by zoelechat
I've just changed product name which is written to usblog in vusb.init script...

-Open for editing 02_04_vusb.init and find the line (line 79 here):

Code: Select all

$(echo -e "[${dev}]\nVendor : SamyGO Virt.\nProduct : SamyGO Virt.\n\
-Change product name, for example:
"Product : SamyGO Virt." to-> "Product : Network"

-That's all!

I've tried various values such as "Virtual USB", "R?seau"... Anyone makes access/browsing of virtual device ~5 times faster compared to original "SamyGO Virt.".
I presume that the trick doesn't speedup only Samba but whole virtual USB in general (no more black screen/loading...). I can't confirm it since I use only Samba shares...

Re: Speedup Samba shares

Posted: Wed Feb 19, 2014 5:18 pm
by juusso
Okey, so simple... let`s wait for other reports.

Re: Speedup Samba shares

Posted: Wed Feb 19, 2014 7:04 pm
by fluffi444
Sounds strange! I have no solution but maybe and point to look at...

Very early in my SamyGo life I wanted to change the Name "SamyGO Virt." (shown in Devices) and changed all SamyGO Virt. in vusb.init to "SamyGO USB"
But this didn't help... After some search I changed the "SamyGO Virt." in "g_file_storage.ko" also (mnt\lib\modules\2.6.35.13\kernel\drivers\usb\gadget) Line 365.
This was the key...

Maybe this differens in g_file_storage.ko and vusb.init does the trick...
You could try to change in g_file_storage.ko to "Network", too - Only overwrite it - do not add more spaces or so... Just to see what happens....

Re: Speedup Samba shares

Posted: Wed Feb 19, 2014 8:00 pm
by Lordbyte
This stuff, - and stuff like it .. should be gathered into a knowledge-database .. or wiki of some sort.

These questions and answers are valuable to users next year also, but the knowledge "drown" on forum
over time as threads progress, and good answers are over time hidden among hundreds of less interesting
posts in a thread due to age.

Everybody please go "hell yea - good idea" :D

Re: Speedup Samba shares

Posted: Wed Feb 19, 2014 8:14 pm
by zoelechat
fluffi444 wrote:Very early in my SamyGo life I wanted to change the Name "SamyGO Virt." (shown in Devices) and changed all SamyGO Virt. in vusb.init to "SamyGO USB"
But this didn't help... After some search I changed the "SamyGO Virt." in "g_file_storage.ko" also (mnt\lib\modules\2.6.35.13\kernel\drivers\usb\gadget) Line 365.
This was the key...
Funny that for me just changing product name in vusb.init is enough...
More funny, I've no g_file_storage.ko module at all, I've even no /usb folder in /kernel/drivers nor any of the requested modules in vusb.init script:

Code: Select all

insmod: can't read '/mnt/lib/modules/2.6.35.13/kernel/drivers/usb/gadget/dummy_hcd.ko': No such file or directory
insmod: can't read '/mnt/lib/modules/2.6.35.13/kernel/drivers/mstar/usb/gadget/dummy_hcd.ko': No such file or directory
insmod: can't read '/mnt/lib/modules/2.6.35.13/kernel/drivers/usb/gadget/g_file_storage.ko': No such file or directory
insmod: can't read '/mnt/lib/modules/2.6.35.13/kernel/drivers/mstar/usb/gadget/g_file_storage.ko': No such file or directory
It seems the big first half of vusb.init script does not concern me, so I've disabled most of it and saved 5 seconds on startup including "sleep 2, sleep 3" (of course virtual usb still works :) )

Then, trying to understand, I've set other product names:
-"SamyGO Virt" (without dot) -> no slowness, so Samsung is not slowing virtual USB by detecting "SamyGO" word :mrgreen:
-"Net Work." -> still as fast, space in the middle or dot at the end cause no problems

Seeing that after doing 30000+ files sharing try, my virtual USB titled "Network" is now slower by 2-3 seconds on "black screen/loading..." even reverting to previous number of shared files, my conclusion for now is that there must be some sort of cache for a specific product name that become saturated.
So, setting a "fresh" product name accelerate considerably things. But maybe I'm wrong... :)

edit: @Lordbyte
Not sure but I may be the only one concerned. Again, my TV seems a bit exotic ;)

Re: Speedup Samba shares

Posted: Thu Feb 20, 2014 4:51 pm
by zoelechat
Based on my hypothesis that a fresh product name is needed, I've introduced a piece of code in vusb.init to add an incrementing counter as suffix of it:

Code: Select all

[...]
CountFile="/mtd_rwcommon/vusb_suffix"
[ ! -f $CountFile ] && echo 1 > $CountFile
N=$(cat $CountFile)
let N=N+1
echo $N > $CountFile

$(echo -e "[${dev}]\nVendor : SamyGO Virt.\nProduct : SamyGo($N)\n\
[...]
Clipboard01.jpg
Now, I also know how many times I've powered on my TV :mrgreen:

Re: Speedup Samba shares

Posted: Thu Feb 20, 2014 4:58 pm
by juusso
Weird, but nice if it works. I tried on D series, even hex-moding g_file_storage.ko. Same speed, same "Loading" time.

Re: Speedup Samba shares

Posted: Thu Feb 20, 2014 5:17 pm
by zoelechat
As far as I understand, vusb.init script uses an alternate method when no g_file_storage.ko module is found (that's the case on my TV, I don't know why I don't have it)
Only this alternate method seems to cause shares becoming slower with time. So, people having g_file_storage.ko module loaded are probably not concerned.

For now, my kludge works flawlessly and really fast, even if it's overkill to change product name on each TV start. :D
It should be needed only from time to time when it becomes slower...