Page MenuHomeFreeBSD

D27500.id80416.diff
No OneTemporary

D27500.id80416.diff

Index: lib/geom/part/geom_part.c
===================================================================
--- lib/geom/part/geom_part.c
+++ lib/geom/part/geom_part.c
@@ -328,7 +328,7 @@
struct ggeom *gp;
struct gprovider *pp;
off_t last, size, start, new_size;
- off_t lba, new_lba, alignment, offset;
+ off_t lba, new_lba, alignment;
const char *s;
int error, idx, has_alignment;
@@ -385,7 +385,6 @@
goto done;
}
- offset = (pp->lg_stripeoffset / pp->lg_sectorsize) % alignment;
s = find_geomcfg(gp, "last");
if (s == NULL)
errx(EXIT_FAILURE, "Final block not found for geom %s",
@@ -405,37 +404,24 @@
start = (off_t)strtoimax(s, NULL, 0);
s = find_provcfg(pp, "end");
lba = (off_t)strtoimax(s, NULL, 0);
- size = lba - start + 1;
pp = find_provider(gp, lba + 1);
- if (new_size > 0 && (new_size <= size || pp == NULL)) {
- /* The start offset may be not aligned, so we align the end
- * offset and then calculate the size.
- */
- new_size = ALIGNDOWN(start + offset + new_size,
- alignment) - start - offset;
- goto done;
- }
- if (pp == NULL) {
- new_size = ALIGNDOWN(last + offset + 1, alignment) -
- start - offset;
- if (new_size < size)
- return (ENOSPC);
- } else {
+ if (pp != NULL) {
s = find_provcfg(pp, "start");
new_lba = (off_t)strtoimax(s, NULL, 0);
- /*
- * Is there any free space between current and
- * next providers?
- */
- new_lba = ALIGNDOWN(new_lba + offset, alignment) - offset;
- if (new_lba > lba)
- new_size = new_lba - start;
- else {
- geom_deletetree(&mesh);
- return (ENOSPC);
- }
- }
+ size = new_lba - start;
+ } else
+ size = last - start + 1;
+
+ /* no size specified, use it all */
+ if (new_size == 0)
+ new_size = size;
+
+ new_size = ALIGNDOWN(new_size, alignment);
+
+ /* a larger size than available was requested, use all available space */
+ if (new_size > size)
+ new_size = ALIGNDOWN(size, alignment);
done:
snprintf(ssize, sizeof(ssize), "%jd", (intmax_t)new_size);
gctl_change_param(req, "size", -1, ssize);

File Metadata

Mime Type
text/plain
Expires
Mon, May 18, 2:50 PM (3 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33250615
Default Alt Text
D27500.id80416.diff (1 KB)

Event Timeline