Bug 198605
Summary: | Mounting vfat fs from usb flash drives with "flush" option causes slow write performance | ||
---|---|---|---|
Product: | File System | Reporter: | pezcurrel (pezcurrel) |
Component: | FAT/VFAT/MSDOS | Assignee: | OGAWA Hirofumi (hirofumi) |
Status: | CLOSED INVALID | ||
Severity: | normal | ||
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 4.14.15-1-ARCH | Subsystem: | |
Regression: | No | Bisected commit-id: |
Description
pezcurrel
2018-01-29 11:25:37 UTC
I forgot to mention that the write speed on the same two drives, when formatted to ext4, is on par with what I get with vfat without the "flush" option (actually, it's a bit faster). Yes, it is intent. If the "flush" option is on, some syscalls wait written data reach to usb flash. In contrast, if off, syscalls just write to memory (data page cache, or metadata buffer). This is to reduce damages of filesystem from unexpected unplugging by writing data to usb flash early. (Or you mean, "flush" option is slower than necessary?) I don't know whether it's slower than necessary since I don't know its internals and wouldn't understand them since I'm not a coder :) , but its speed is half the speed I get when not using it *taking into account the unmount time*. I mean: if the "flush" option is not used data get cached more, but when unmounting, the cached data still need to be written, so I would expect the overall time taken by "copying the same files + unmounting soon after copying" to be approximately the same with or without the "flush" option. What I see instead is that when the "flush" option is on the overall time taken by "copying the same files + unmounting soon after copying" is almost double the time it takes without "flush" option. It is possible with depending on type of load. Say, we are writing 5 files. With "flush", basically, flush a file for each a write. Because filesystem doesn't know whether user writes 4 more files or not. And then, directory and metadata will be written 5 times. In contrast, in no "flush" option case, directory and metadata are also cached and flushed at once time. This would be main reason of why. And unfortunately, heuristic (to detect more files) of "flush" option is quite not sophisticated that applied to FAT. Thank you for your answer :) I did some more tests on my laptop (previously I tested on my desktop pc). Turns out on my laptop writing one big file (1 gb) to the pendrive and unmounting it soon after that takes almost exactly the same time with or without the "flush" option. I don't know why on my desktop pc it takes double the time with "flush" than without. Moreover, I tried copying many little files (many mp3 files for a total of 1.6 gb). On this test, writing to the pendrive mounted *with* the "flush" option proved to be much faster than without, and this seems to me contradictory with what you explained in your previous comment. So, I'm lost :)) Thanks you for testing. |