-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add lazy mode for fat32 to speed up writes #261
base: master
Are you sure you want to change the base?
Conversation
For example, it reduces time to create ~5GB file system from 7m40s to 1m30s on my laptop.
f247aac
to
e6fcaed
Compare
This is interesting. You are not saying it for everything, but as an option. Normally, every time you allocate space, you need to update the FAT tables and FSIS, so it can know what is next. That usually is the point of locking; once that is done, other things can be done somewhat more in parallel. You are saying to have an option to only write them when I am done, by calling
It isn't creating the 5GB filesystem, is it? It is creating the files, where each Let's think the approach through. As long as the lazy is an option - "enable this option and you run the risk of breaking things, and it no longer is thread-safe, do so at your own risk" (and I am not 100% sure it s thread-safe anyways), then I think it makes sense. However, rather than having I also would want a dirty flag, so we know that it has not been committed. The other question I would ask is if this is the best approach. One easy way to resolve this is to call Another option is to add
Thoughts? |
@deitch, thank you for looking into it! Yeah, it's questionable, so I kept it as a draft to have a discussion. I agree about the dirty flag and caller-side lazy handling. I've been using
I'm sorry. I'm creating a filesystem from scratch and adding ~5GB of files of various sizes and a reasonably big directory tree. That's the creation of Flatcar Linux LiveCD with an Airgap installer for our product. |
Flatcar! I like not only the product, but the people behind it.
Do you want to do a separate PR for that? It should be light and easy, especially because you don't need to change any other interfaces.
I am curious. Do post what you find? Might be some bug in here, or some assumption we made. |
For example, it reduces the time to create ~5GB file system from 7m40s to 1m40s on my laptop.
The main root cause is that currently on every space allocation Fsis/FAT are written and while they're fairly small (like 6-7MB) but it's happening on every "Write" call which is tens of sounds when writing a lot of files.
You can see on the following flame graphs that actual file writes are almost invisible comparing to writing Fsis/FAT.
With v1.4.2:
Patched, lazy mode enabled:
I tried to minimize changes to the Public API.