Skip to content

Conversation

@smira
Copy link
Member

@smira smira commented Nov 13, 2025

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.

lowLBA: lowLBA,
highLBA: highLBA,
partitionIdx: partitionIdx,
size: (highLBA - lowLBA) * uint64(t.sectorSize),
Copy link
Member Author

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
Copy link
Member Author

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

Copy link
Member Author

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",
Copy link
Member Author

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>
@smira smira force-pushed the fix/partition-alloc-v2 branch from b61e1de to 1216693 Compare November 13, 2025 18:16
@shanduur shanduur self-requested a review November 14, 2025 07:43
@github-project-automation github-project-automation bot moved this from In Review to Approved in Planning Nov 14, 2025
@smira
Copy link
Member Author

smira commented Nov 14, 2025

/m

@talos-bot talos-bot merged commit 1216693 into siderolabs:v2 Nov 14, 2025
21 of 24 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Planning Nov 14, 2025
smira added a commit to smira/talos that referenced this pull request Nov 14, 2025
Pulls in siderolabs/go-blockdevice#139.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
smira added a commit to smira/talos that referenced this pull request Nov 14, 2025
Pulls in siderolabs/go-blockdevice#139.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants