Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow file moving and deletion #272

Closed
mb720 opened this issue May 14, 2021 · 3 comments
Closed

Slow file moving and deletion #272

mb720 opened this issue May 14, 2021 · 3 comments

Comments

@mb720
Copy link
Contributor

mb720 commented May 14, 2021

Hi!

I assume this is a limitation of MTP, but I was wondering why deleting or moving files is rather slow.

I have the internal storage of a Samsung Galaxy J5 mounted using aft-mtp-mount. Being used to the behavior of ext4, NTFS, and FAT, I was expecting that deleting or moving a file is fast, since only the values of an inode or a directory entry have to be changed.

But it seems that when moving files from one directory of the phone to another directory (still on the phone), all the bytes of the files have to be moved. Similar when deleting files: from the time it takes, it looks as if the bytes of the file are overwritten.

I'm curious how moving and deleting are implemented in MTP since the operation seem to take time proportional to the size of the file.

@whoozle
Copy link
Owner

whoozle commented May 19, 2021

MTP spec says MoveObject is optional and I haven't seen it in real device even once.

There's some limited support for renaming within one directory (should be fast using fuse). Normally all those operations are happening in database, and also RemoveObject is recursive, potentially it's very slow.

@whoozle
Copy link
Owner

whoozle commented May 19, 2021

Rephrasing a bit it means execution time does not really depend on file system performance, but more on internal media database performance. In android it's normally sqlite, and it's not very good with large number of rows.

@whoozle
Copy link
Owner

whoozle commented May 19, 2021

Investigated as a part of #56

@whoozle whoozle closed this as completed May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants