linux-apfs / linux-apfs-rw

APFS module for linux, with experimental write support
GNU General Public License v2.0
510 stars 34 forks source link

It works very slowly on physical medias. #46

Open 31core opened 1 year ago

31core commented 1 year ago

This kernel module writes fast with an APFS on a loop back device, however it works slowly when writing file on a USB flash drive. I tested writing 9 files with totally 98.9 MB in size, here are the results:

APFS:

im31core@31core-PC:~$ time sync

real    0m51.889s
user    0m0.000s
sys 0m1.163s

exFat:

im31core@31core-PC:~$ time sync

real    0m3.385s
user    0m0.001s
sys 0m0.003s

My kernel version is 6.2.0-20-generic, and my USB flash is SanDisk Ultra USB 3.0, and the performance test result should be the same on other devices.

eafer commented 1 year ago

That's terrible, thanks for the report. I'll see if I can find an unused usb drive and I'll get back to you.

eafer commented 1 year ago

I can't reproduce, the copy takes around 7 seconds for me on the 6.2 kernel. Slower than exfat for sure, but that's expected because I haven't done any profiling for kernel versions other than 5.3.

Have you seen this happen more than once? Right after formatting the usb drive? Do you get any output on dmesg?

Damenly commented 1 year ago

Calling sync is unfair since page cache of all filesystems will be written to storage. dd to files in mounted fs will be more explanatory and easier to reproduce.

eafer commented 1 year ago

Right, that's why I asked him if he had seen this happen more than once, I thought maybe his sync flushed some other stuff as well.

31core commented 1 year ago

I can't reproduce, the copy takes around 7 seconds for me on the 6.2 kernel. Slower than exfat for sure, but that's expected because I haven't done any profiling for kernel versions other than 5.3.

Have you seen this happen more than once? Right after formatting the usb drive? Do you get any output on dmesg?

Yeah, I first found this issue when I copied files using my Dell Poweredge R710 with linux kernel 5.15 several months ago. I'm not sure if it's a problem with my device because OpenZFS also performed badly(even worse than APFS). But other file systems on linux have no such problem.

eafer commented 1 year ago

I don't think I can help you much if I can't reproduce this. If you are interested, maybe you can try to run the profiler yourself, and then we could check the output.

31core commented 1 year ago

I don't think I can help you much if I can't reproduce this. If you are interested, maybe you can try to run the profiler yourself, and then we could check the output.

Have you tested it on ubuntu? It might be the problem of ubuntu's kernel configuration, I guess. Maybe you can reproduce it on ubuntu 22.04 or 23.04.

eafer commented 1 year ago

Yes, I tested on Ubuntu 23.04 with your same kernel. It was on a vm, but I was using the physical usb drive, so I don't think it should make a difference. I also tested on Ubuntu 22.04 with 5.15 kernel.