-
Notifications
You must be signed in to change notification settings - Fork 16
fix: allocation partition size for gaps #139
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
Conversation
| lowLBA: lowLBA, | ||
| highLBA: highLBA, | ||
| partitionIdx: partitionIdx, | ||
| size: (highLBA - lowLBA) * uint64(t.sectorSize), |
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.
wrong size calculation here previously - both high and low LBAs are inclusive, so +1
| highLBA = t.entries[partitionIdx].FirstLBA - 1 | ||
| } else { | ||
| highLBA = t.lastUsableLBA | ||
| highLBA = highLBA/t.alignment*t.alignment - 1 |
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.
we don't need to decrement -1 here, but to keep the code from trying to grow the last partition on the disk, a small fix up to compensate for the previous bug
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.
1 here is 1 LBA, 1 sector, so 512 bytes wasted
| expectedGdiskDump: loadTestdata(t, "allocate.gdisk"), | ||
| }, | ||
| { | ||
| name: "allocate with small delete", |
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.
this is a regression test
We don't need to align highLBA (or the end of the next partition), as otherwise we can't drop and re-create the partition in the same place. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
Fix linting issues. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
b61e1de to
1216693
Compare
|
/m |
Pulls in siderolabs/go-blockdevice#139. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
Pulls in siderolabs/go-blockdevice#139. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
We don't need to align highLBA (or the end of the next partition), as
otherwise we can't drop and re-create the partition in the same place.