mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-05 08:00:30 +00:00
o When creating the EBR scheme, set the number of entries
properly. Otherwise the minimum of 1 is used and you can only insert a single partition/slice and only at sector 0 (index 1). o When adding a partition/slice, recalculate the index after the start and size of the partition/slice are adjusted to make them a multiple of the track size. Since the precheck method sets the index based on the start of the partition as provided by the user, we know that we're off by at most 1 and adjusting the index is safe.
This commit is contained in:
parent
7c84b0bd94
commit
232c8bf888
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=188899
|
@ -218,6 +218,7 @@ g_part_ebr_add(struct g_part_table *basetable, struct g_part_entry *baseentry,
|
|||
|
||||
KASSERT(baseentry->gpe_start <= start, (__func__));
|
||||
KASSERT(baseentry->gpe_end >= start + size - 1, (__func__));
|
||||
baseentry->gpe_index = (start / sectors) + 1;
|
||||
baseentry->gpe_offset = (off_t)(start + sectors) * pp->sectorsize;
|
||||
baseentry->gpe_start = start;
|
||||
baseentry->gpe_end = start + size - 1;
|
||||
|
@ -257,6 +258,7 @@ g_part_ebr_create(struct g_part_table *basetable, struct g_part_parms *gpp)
|
|||
return (ENXIO);
|
||||
|
||||
msize = pp->mediasize / pp->sectorsize;
|
||||
basetable->gpt_entries = msize / basetable->gpt_sectors;
|
||||
basetable->gpt_first = 0;
|
||||
basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
|
||||
return (0);
|
||||
|
|
Loading…
Reference in a new issue