-
Notifications
You must be signed in to change notification settings - Fork 83
Quota enforcing sector allocator #170
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
base: main
Are you sure you want to change the base?
Quota enforcing sector allocator #170
Conversation
0db9a22 to
eeabec1
Compare
4b48152 to
0556176
Compare
|
Latest version of an implementation of a quota enforcing sector allocator. There are some possible performance improvements that have not been pursued: GetNextUnmappedSector when run in a dense region iterates through all sectors until it finds an unmapped one, this is not worse than what was done before but if run on e.g. a 16TB dense file from byte zero would require 2^32 iterations until it found an unmapped sector. With some bookkeeping this could probably be reduced. GetLogicalSize keeps track of the last mapped sector of the pointer by manipulating an internal variable. This needs to be recalculated whenever truncated to smaller than the mapped sector. With a better implementation of GetNextUnmappedSector this might be possible to do faster by alternating between GetNextUnmappedSector and GetNextMappedSector until it reaches the last mapped sector less than what was truncated to. |
| // returned. If there are no more mapped sectors then io.EOF is | ||
| // returned. | ||
| func (sp *SectorPointer) GetNextMappedSector(logical uint32) (uint32, error) { | ||
| from := logical |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code is a bit hard to read due to the excessive use of helper variables. What are your thoughts on getting rid of next and from? Can't we just write:
for {
var list []uint32
logical, list = sp.getNextDirectSectorList(logical)
...
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really find this suggestion making things any clearer, I appreciate that the why of GetNextMappedSector is not very clear unless you know how the helper getNextDirectSectorList works. I have added some documentation to getNextDirectSectorList and reworked it somewhat to get around an overflow bug. Please have a look again if you still find it too unclear.
57ff47f to
97c21f2
Compare
|
With the modifications after the pull request GetLogicalSize could be removed. Tests that verify functionality around the boundary conditions the has been added (and the corresponding bug they discovered has been fixed). |
|
In #200 Jille and I added support for configuring the 'HoleSource' of a FilePool file. However, we didn't go as far that we changed BlockDeviceBackedFilePool to use an inode tree structure. It's still a list. Benjamin, would you be interested in rebasing this change on top of what's in main right now? So:
|
|
Sure I'll get on that |
97c21f2 to
7006bdc
Compare
|
|
Rebased quota enforced sector allocator on top of what is in main and made the tests pass. As the rebase was pretty big it might be worth making another review pass at this. |
11dd8a9 to
3f4f917
Compare
``` Moves disk quota enforcement to sector allocator, this allows the file pool to have arbitrary large sparse files without running into quota issues. A consequence of this is that very large sparse files are now a first class citizen of Buildbarn. We have therefore modified the sparse files implementation to use a struct inspired by the unix inode pointer struct. ```
3f4f917 to
9bed942
Compare

Uh oh!
There was an error while loading. Please reload this page.