Slow directory listing with gvfs-smb
Submitted by Laurențiu Nicola
Assigned to gvf..@..e.bugs
Possibly related to #543640 although I'm seeing about the same thing with "gio list" and ls.
Directory enumeration (when running ls, browsing from nautilus etc.) is very slow. ls calls lstat on each file. Wireshark shows that gvfs-smb is using SMB2, but does a Create/GetInfo/Close sequence on each lstat() call. ls -l takes 11 seconds for a 500-file directory, gio ls takes 8 seconds but does the same calls.
mount.cifs defaults to SMB1 and uses FIND_NEXT2 for lstat and QUERY_PATH_INFO for getxattr. With that, ls takes 100 ms and ls -l takes 3s.
mount.cifs -o vers=3.0 uses SMB2_FIND_ID_FULL_DIRECTORY_INFO. With that, ls takes around 80 ms and ls -l around 100 ms, but the difference is probably in the time it takes to display the output.