-
Notifications
You must be signed in to change notification settings - Fork 817
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 LFS_F_WRUNCHECKED option to avoid validation and hence reading blocks when writing #1056
base: master
Are you sure you want to change the base?
Conversation
Tests passed ✓, Code: 17136 B (+0.0%), Stack: 1440 B (+0.0%), Structs: 812 B (+0.0%)
|
Hi @andyp1per, thanks for creating a PR. Have you considered making this a filesystem-wide ifdef, say, LFS_NO_CKPROGS? That way you could also avoid the reads to validate metadata commits (here). I have a similar thing on a fork (albeit via mount flags). I'm curious, did this impact performance noticeably? I've been viewing this as low priority as I assumed the read overhead for validation would always be overshadowed by the related prog+erase overhead. |
I am interested in other types of file being checked, that's why I went for a per-file option. It might also be possible to set it temporarily - so for instance our logs are self-describing, we probably want the description to be stored reliably but the data not so much. read is about 10x faster than write and it also chews up the SPI bus, so not nothing - in my testing so far this plus avoiding checking the file size seems to get me where I need to, but I need to do another full flight test to fully check |
Hi @andyp1per, just a quick update. I think I'm going to have to leave this open for a while due to how it interacts with future work. In the ongoing experimental branch (rbyd), the separation of file data-structure and metadata data-structure becomes quite a bit more muddy, so I'm not sure it will be possible to set this flag on a per-file basis. I'm also growing a bit concerned we're going to run out of 32-bit flags with the current planned features... |
BTW, what does "rbyd" mean? |
That's a good question! It's the name of the new metadata-data structure that started the branch. The original goal was to bring mdir compaction down from At this point it's sort of snowballed into a number of seemingly unrelated features. I'm not particularly happy with how it's snowballed, but also not sure there's a better way to go about it. With filesystems/storage, things get "stuck" as soon as they're released, so new features need somewhere to "stew" while details/bugs get worked out... The name itself comes from combining Dhara trees (which you may know about, it and the Dhara FTL are really quite neat), with a red-black-yellow tree to make it self-balancing and order-statistic. Maybe not the greatest name, but a name's a name. There's a lot to write about it, but that's also a todo item... |
I should also mention I do plan to have a sort of "request-for-comments/feedback" period before stabilizing, but at the moment I'm still trying to get the details/kinks worked out. |
One neat example, order-statistic operations make things like Lines 1133 to 1139 in 1f3c47b
Which I think will be quite useful for maintaining logs without needing multiple files. |
Presumably that would make a posix compliant version of SEEK_SET possible. |
It does make random writes efficient, that is another big benefit. Though I believe the current implementation of SEEK_SET is technically POSIX compliant, if only practical for random reads and random writes to small files. |
This is the bit that is not supported:
|
Ah, I see. Yes, that's a good point, sparse files are a nice side-effect of B-trees. I'm curious if what use cases you've seen for sparse files (SQLite?). I've been considering them low-priority since advanced file manipulation seems relatively rare in this space. Sparse files are actually already implemented (it'd be a bit silly not to with B-trees), but more advanced APIs like SEEK_DATA, |
In ArduPilot we predominantly stream logs to disk while flying. In our current block logger we do this without validation and this PR adds an option to skip validation while writing to streamline the writing process.
Also fixes a build issue with the file backend when compiling without debug.