JasonFerrara / jmtpfs

GNU General Public License v3.0
164 stars 19 forks source link

Very slow getattr in some directories #34

Open delan opened 5 months ago

delan commented 5 months ago

jmtpfs lists directories much slower than go-mtpfs and simple-mtpfs, sometimes over 50 seconds in directories with only one child. The same directories tend to be affected every time for me.

This is especially unfortunate, because jmtpfs reads files the fastest of all of the clients I’ve tried so far.

$ cd /mnt/phone
$ time ls
'Internal shared storage'
ls --color=tty  0.00s user 0.00s system 1% cpu 0.097 total

$ cd Internal\ shared\ storage
$ time ls
Alarms  Android  Audiobooks  DCIM  Documents  Download  Movies  Music  Notifications  Pictures  Podcasts  Recordings  Ringtones
ls --color=tty  0.00s user 0.00s system 0% cpu 1.093 total

$ cd DCIM
$ time ls
Camera
ls --color=tty  0.00s user 0.00s system 0% cpu 54.539 total
$ jmtpfs -s -d /mnt/phone
Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP).
Android device detected, assigning default bug flags
FUSE library version: 2.9.9
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 2, opcode: INIT (26), nodeid: 0, insize: 104, pid: 0
INIT: 7.37
flags=0x73fffffb
max_readahead=0x00020000
   INIT: 7.19
   flags=0x00000011
   max_readahead=0x00020000
   max_write=0x00020000
   max_background=0
   congestion_threshold=0
   unique: 2, success, outsize: 40
unique: 4, opcode: ACCESS (34), nodeid: 1, insize: 48, pid: 258121
   unique: 4, error: -38 (Function not implemented), outsize: 16
unique: 6, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 258121
getattr /
   unique: 6, success, outsize: 120
unique: 8, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 314501
   unique: 8, success, outsize: 32
unique: 10, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 314501
getattr /
   unique: 10, success, outsize: 120
unique: 12, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 314501
readdir[0] from 0
   unique: 12, success, outsize: 128
unique: 14, opcode: LOOKUP (1), nodeid: 1, insize: 64, pid: 314501
LOOKUP /Internal shared storage
getattr /Internal shared storage
   NODEID: 2
   unique: 14, success, outsize: 144
unique: 16, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 314501
   unique: 16, success, outsize: 16
unique: 18, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0
   unique: 18, success, outsize: 16
unique: 20, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 258121
   unique: 20, success, outsize: 32
unique: 22, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 258121
getattr /
   unique: 22, success, outsize: 120
unique: 24, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 258121
readdir[0] from 0
   unique: 24, success, outsize: 128
unique: 26, opcode: LOOKUP (1), nodeid: 1, insize: 64, pid: 258121
LOOKUP /Internal shared storage
getattr /Internal shared storage
   NODEID: 2
   unique: 26, success, outsize: 144
unique: 28, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 258121
   unique: 28, success, outsize: 16
unique: 30, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0
   unique: 30, success, outsize: 16
unique: 32, opcode: LOOKUP (1), nodeid: 1, insize: 66, pid: 258121
LOOKUP /Internal\ shared\ storage
getattr /Internal\ shared\ storage
   unique: 32, error: -2 (No such file or directory), outsize: 16
unique: 34, opcode: LOOKUP (1), nodeid: 1, insize: 66, pid: 258121
LOOKUP /Internal\ shared\ storage
getattr /Internal\ shared\ storage
   unique: 34, error: -2 (No such file or directory), outsize: 16
unique: 36, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 258121
getattr /
   unique: 36, success, outsize: 120
unique: 38, opcode: OPENDIR (27), nodeid: 2, insize: 48, pid: 314587
   unique: 38, success, outsize: 32
unique: 40, opcode: GETATTR (3), nodeid: 2, insize: 56, pid: 314587
getattr /Internal shared storage
   unique: 40, success, outsize: 120
unique: 42, opcode: READDIR (28), nodeid: 2, insize: 80, pid: 314587
readdir[0] from 0
   unique: 42, success, outsize: 536
unique: 44, opcode: LOOKUP (1), nodeid: 2, insize: 49, pid: 314587
LOOKUP /Internal shared storage/Pictures
getattr /Internal shared storage/Pictures
   NODEID: 3
   unique: 44, success, outsize: 144
unique: 46, opcode: LOOKUP (1), nodeid: 2, insize: 51, pid: 314587
LOOKUP /Internal shared storage/Audiobooks
getattr /Internal shared storage/Audiobooks
   NODEID: 4
   unique: 46, success, outsize: 144
unique: 48, opcode: LOOKUP (1), nodeid: 2, insize: 47, pid: 314587
LOOKUP /Internal shared storage/Alarms
getattr /Internal shared storage/Alarms
   NODEID: 5
   unique: 48, success, outsize: 144
unique: 50, opcode: LOOKUP (1), nodeid: 2, insize: 51, pid: 314587
LOOKUP /Internal shared storage/Recordings
getattr /Internal shared storage/Recordings
   NODEID: 6
   unique: 50, success, outsize: 144
unique: 52, opcode: LOOKUP (1), nodeid: 2, insize: 48, pid: 314587
LOOKUP /Internal shared storage/Android
getattr /Internal shared storage/Android
   NODEID: 7
   unique: 52, success, outsize: 144
unique: 54, opcode: LOOKUP (1), nodeid: 2, insize: 46, pid: 314587
LOOKUP /Internal shared storage/Music
getattr /Internal shared storage/Music
   NODEID: 8
   unique: 54, success, outsize: 144
unique: 56, opcode: LOOKUP (1), nodeid: 2, insize: 50, pid: 314587
LOOKUP /Internal shared storage/Documents
getattr /Internal shared storage/Documents
   NODEID: 9
   unique: 56, success, outsize: 144
unique: 58, opcode: LOOKUP (1), nodeid: 2, insize: 49, pid: 314587
LOOKUP /Internal shared storage/Podcasts
getattr /Internal shared storage/Podcasts
   NODEID: 10
   unique: 58, success, outsize: 144
unique: 60, opcode: LOOKUP (1), nodeid: 2, insize: 47, pid: 314587
LOOKUP /Internal shared storage/Movies
getattr /Internal shared storage/Movies
   NODEID: 11
   unique: 60, success, outsize: 144
unique: 62, opcode: LOOKUP (1), nodeid: 2, insize: 45, pid: 314587
LOOKUP /Internal shared storage/DCIM
getattr /Internal shared storage/DCIM
   NODEID: 12
   unique: 62, success, outsize: 144
unique: 64, opcode: LOOKUP (1), nodeid: 2, insize: 54, pid: 314587
LOOKUP /Internal shared storage/Notifications
getattr /Internal shared storage/Notifications
   NODEID: 13
   unique: 64, success, outsize: 144
unique: 66, opcode: LOOKUP (1), nodeid: 2, insize: 49, pid: 314587
LOOKUP /Internal shared storage/Download
getattr /Internal shared storage/Download
   NODEID: 14
   unique: 66, success, outsize: 144
unique: 68, opcode: LOOKUP (1), nodeid: 2, insize: 50, pid: 314587
LOOKUP /Internal shared storage/Ringtones
getattr /Internal shared storage/Ringtones
   NODEID: 15
   unique: 68, success, outsize: 144
unique: 70, opcode: READDIR (28), nodeid: 2, insize: 80, pid: 314587
   unique: 70, success, outsize: 16
unique: 72, opcode: RELEASEDIR (29), nodeid: 2, insize: 64, pid: 0
   unique: 72, success, outsize: 16
unique: 74, opcode: OPENDIR (27), nodeid: 2, insize: 48, pid: 258121
   unique: 74, success, outsize: 32
unique: 76, opcode: GETATTR (3), nodeid: 2, insize: 56, pid: 258121
getattr /Internal shared storage
   unique: 76, success, outsize: 120
unique: 78, opcode: READDIR (28), nodeid: 2, insize: 80, pid: 258121
readdir[0] from 0
   unique: 78, success, outsize: 536
unique: 80, opcode: LOOKUP (1), nodeid: 2, insize: 49, pid: 258121
LOOKUP /Internal shared storage/Pictures
getattr /Internal shared storage/Pictures
   NODEID: 3
   unique: 80, success, outsize: 144
unique: 82, opcode: LOOKUP (1), nodeid: 2, insize: 51, pid: 258121
LOOKUP /Internal shared storage/Audiobooks
getattr /Internal shared storage/Audiobooks
   NODEID: 4
   unique: 82, success, outsize: 144
unique: 84, opcode: LOOKUP (1), nodeid: 2, insize: 47, pid: 258121
LOOKUP /Internal shared storage/Alarms
getattr /Internal shared storage/Alarms
   NODEID: 5
   unique: 84, success, outsize: 144
unique: 86, opcode: LOOKUP (1), nodeid: 2, insize: 51, pid: 258121
LOOKUP /Internal shared storage/Recordings
getattr /Internal shared storage/Recordings
   NODEID: 6
   unique: 86, success, outsize: 144
unique: 88, opcode: LOOKUP (1), nodeid: 2, insize: 48, pid: 258121
LOOKUP /Internal shared storage/Android
getattr /Internal shared storage/Android
   NODEID: 7
   unique: 88, success, outsize: 144
unique: 90, opcode: LOOKUP (1), nodeid: 2, insize: 46, pid: 258121
LOOKUP /Internal shared storage/Music
getattr /Internal shared storage/Music
   NODEID: 8
   unique: 90, success, outsize: 144
unique: 92, opcode: LOOKUP (1), nodeid: 2, insize: 50, pid: 258121
LOOKUP /Internal shared storage/Documents
getattr /Internal shared storage/Documents
   NODEID: 9
   unique: 92, success, outsize: 144
unique: 94, opcode: LOOKUP (1), nodeid: 2, insize: 49, pid: 258121
LOOKUP /Internal shared storage/Podcasts
getattr /Internal shared storage/Podcasts
   NODEID: 10
   unique: 94, success, outsize: 144
unique: 96, opcode: LOOKUP (1), nodeid: 2, insize: 47, pid: 258121
LOOKUP /Internal shared storage/Movies
getattr /Internal shared storage/Movies
   NODEID: 11
   unique: 96, success, outsize: 144
unique: 98, opcode: LOOKUP (1), nodeid: 2, insize: 45, pid: 258121
LOOKUP /Internal shared storage/DCIM
getattr /Internal shared storage/DCIM
   NODEID: 12
   unique: 98, success, outsize: 144
unique: 100, opcode: LOOKUP (1), nodeid: 2, insize: 54, pid: 258121
LOOKUP /Internal shared storage/Notifications
getattr /Internal shared storage/Notifications
   NODEID: 13
   unique: 100, success, outsize: 144
unique: 102, opcode: LOOKUP (1), nodeid: 2, insize: 49, pid: 258121
LOOKUP /Internal shared storage/Download
getattr /Internal shared storage/Download
   NODEID: 14
   unique: 102, success, outsize: 144
unique: 104, opcode: LOOKUP (1), nodeid: 2, insize: 50, pid: 258121
LOOKUP /Internal shared storage/Ringtones
getattr /Internal shared storage/Ringtones
   NODEID: 15
   unique: 104, success, outsize: 144
unique: 106, opcode: READDIR (28), nodeid: 2, insize: 80, pid: 258121
   unique: 106, success, outsize: 16
unique: 108, opcode: RELEASEDIR (29), nodeid: 2, insize: 64, pid: 0
   unique: 108, success, outsize: 16
unique: 110, opcode: GETATTR (3), nodeid: 2, insize: 56, pid: 258121
getattr /Internal shared storage
   unique: 110, success, outsize: 120
unique: 112, opcode: LOOKUP (1), nodeid: 1, insize: 64, pid: 258121
LOOKUP /Internal shared storage
getattr /Internal shared storage
   NODEID: 2
   unique: 112, success, outsize: 144
unique: 114, opcode: OPENDIR (27), nodeid: 12, insize: 48, pid: 314714
   unique: 114, success, outsize: 32
unique: 116, opcode: GETATTR (3), nodeid: 12, insize: 56, pid: 314714
getattr /Internal shared storage/DCIM
   unique: 116, success, outsize: 120
unique: 118, opcode: READDIR (28), nodeid: 12, insize: 80, pid: 314714
readdir[0] from 0
   unique: 118, success, outsize: 112
unique: 120, opcode: LOOKUP (1), nodeid: 12, insize: 47, pid: 314714
LOOKUP /Internal shared storage/DCIM/Camera
getattr /Internal shared storage/DCIM/Camera
[50-second delay]
   NODEID: 16
   unique: 120, success, outsize: 144
unique: 122, opcode: READDIR (28), nodeid: 12, insize: 80, pid: 314714
   unique: 122, success, outsize: 16
unique: 124, opcode: RELEASEDIR (29), nodeid: 12, insize: 64, pid: 0
   unique: 124, success, outsize: 16