Bug 346619 - MTP IOSlave should use f_bsize for block size
Summary: MTP IOSlave should use f_bsize for block size
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.47.0
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-25 07:25 UTC by Vladimir
Modified: 2022-10-18 04:58 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir 2015-04-25 07:25:33 UTC
I'm testing fuse wrapper for mtp filesystem and it's incredibly slow using dolphin (10 times slower than direct usb bulk transaction, ~1-2Mb/s versus 10-15Mb/s). I found out that dolphin ignores f_bsize from statvfs structure, which indicates filesystem block size and uses 4096 bytes buffer for copying. 
I believe that writing in fylesystem block sizes, is better way, because filesystem driver writes incompleted blocks to device which could be ineffective, in a case of mtp, overhead of partial write to object is rather big, so I set block size to 1Mb. So, the buffer's size might be something like: max(4096, f_bsize). 

Reproducible: Always

Steps to Reproduce:
1. Clone and build https://github.com/whoozle/android-file-transfer-linux 
2. Connect any mtp device
3. Run ./afs-mtp-mount -d -f <mountpoint>
4. See fuse logs. 

Actual Results:  
Data is read/written in 4096 bytes blocks.

Expected Results:  
Data is read/written in f_bsize bytes blocks.
Comment 1 Nate Graham 2018-06-29 17:45:24 UTC
Is this still an issue with KDE Frameworks 5.47 and Dolphin 18.04.x?
Comment 2 Vladimir 2018-06-30 20:58:37 UTC
(In reply to Nate Graham from comment #1)
> Is this still an issue with KDE Frameworks 5.47 and Dolphin 18.04.x?

Soft of. This problem has been leveraged by increasing IO size in recent versions, it's 128K now. But it's still not taking f_frsize/f_bsize into account.
Comment 3 Nate Graham 2018-07-02 02:45:52 UTC
Thanks for the update! So the slowness of not respecting f_bsize manifested when you used Dolphin to move or copy a file (via copy-paste or drag-and-drop) to a local mount for an MTP device?
Comment 4 Vladimir 2018-07-02 17:28:12 UTC
(In reply to Nate Graham from comment #3)
> Thanks for the update! So the slowness of not respecting f_bsize manifested
> when you used Dolphin to move or copy a file (via copy-paste or
> drag-and-drop) to a local mount for an MTP device?

Yes, it was like that. Current value 128K is enough for everyone © Almost

I think it's generally good practive to align IO size to size of filesystem block, so filesystem will not squeeze your data into any tail-space in case of small write, etc. 

My MTP implementation uses partial reads/writes to avoid full object sending/retrieval, making MTP as fast as any other way to transfer data from/to device. 

The problem with partial objects, it's done from userspace on android, and this approach has an additional overhead of starting/committing object transaction.
I've decided to advertise large block size to userspace, it worked with some other file managers, but not the dolphin.  :)

Thanks
Comment 5 Nate Graham 2018-07-15 02:54:54 UTC
Thanks for the info! As soon as I figure out where this setting is located, I'll submit a patch. If you know where I can find it, please don't be shy! :)
Comment 6 Christoph Feck 2018-08-02 19:43:17 UTC
Nate, the f_bsize setting can be found via http://man7.org/linux/man-pages/man3/statvfs.3.html

But I am not sure if KIO should look at it. My filesystem block size reports 4K, so general file copying would get slower respecting it compared to the 128K value we use now.
Comment 7 Nate Graham 2018-08-03 03:28:03 UTC
If the default value is good enough now, and respecting the system's value might be worse, maybe we should close this?
Comment 8 postix 2022-09-18 12:19:11 UTC
> If the default value is good enough now, and respecting the system's value might be worse, maybe we should close this?
Comment 9 Bug Janitor Service 2022-10-03 04:48:58 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 10 Bug Janitor Service 2022-10-18 04:58:34 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!