-
Notifications
You must be signed in to change notification settings - Fork 155
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
Use the first fitting gap for ESP, instead of the largest gap #1765
Conversation
@@ -252,6 +252,14 @@ def largest_gap_size(device, in_extended=None): | |||
return 0 | |||
|
|||
|
|||
def gap_with_size(device, size, *, in_extended=None): | |||
for pg in parts_and_gaps(device): |
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.
gap_with_size
sounds like any gap will do that fits the requirement, or maybe even the closest gap (first gap is large, second gap is small but large enough, choose the second). Would you add a docstring clarifying intent?
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 changed the method name to 'first_gap_with_size'. For this use case, finding the smallest suitable gap might actually make more sense but well. Minor stuff I think.
subiquity/common/filesystem/boot.py
Outdated
@@ -224,7 +224,7 @@ def get_add_part_plan(device, *, spec, args, resize_partition=None): | |||
# is a bad idea. So avoid putting any sort of boot stuff on a logical - | |||
# it's probably a bad idea for all cases. | |||
|
|||
gap = gaps.largest_gap(device, in_extended=False) | |||
gap = gaps.gap_with_size(device, size, in_extended=False) | |||
if gap is not None and gap.size >= size and gap.is_usable: |
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.
Some of the logic is redundant now
This is basically @medicalwei's #1764 with potentially useful functionality factored into a method.